question

DarpanRuparel-9136 avatar image
0 Votes"
DarpanRuparel-9136 asked Yufeishao-msft commented

Delimiter is not separating the Statements.

I am fairly new to the SQL Server Management Studio. I just installed it running the first code. For me, the delimiter; is not separating the statements. As you can see in the picture attached, all the statements are grouped, and when I run any one of them all three run at the same time. See the window below for the run code result.

I have tried POP SQL, this doen't happen in it. Each time when I hit Run, only the potion where my cursor is the code until delimiter runs.

My question is - is there any setting to make the SSMS recognize the delimiter and in the outlining, not to group the statements separated by a ";" delimiter. Here all three codes are part of one group as only one outline. Normally, only the code until the delimiter is part of one outlined group.


195894-screenshot-2022-04-24-210228.png


sql-server-general
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Could you please validate all the answers so far and provide any update?
Please remember to accept the answers if they helped. Your action would be helpful to other users who encounter the same issue and read this thread.

Thank you for understanding!

0 Votes 0 ·

1 Answer

Yufeishao-msft avatar image
0 Votes"
Yufeishao-msft answered Yufeishao-msft commented

Hi @DarpanRuparel-9136

Query with SSMS will excute all the contents of the current window, unless highlight a query and then run
You can choose to select directly with the mouse, or be quicker, you can just click on a line number, which will highlight the whole line




If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.





· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @Yufeishao-msft 195946-5d1ed7c8-cf9b-4ea4-8e12-8168e6f4636e.jpeg

Thanks for the response. Okay I understand the behaviour of running the whole code the screen in SSMS from your response.

But as in the picture I posted with the question, please look at the outline. Shouldn’t the outline be separated by the delimiter?

I am attaching a picture that I found on YouTube. Here the outline shows different groups based on delimiter. I have circled red on it.

Thanks for your help.


0 Votes 0 ·
Yufeishao-msft avatar image Yufeishao-msft DarpanRuparel-9136 ·

Hi @DarpanRuparel-9136,

About Code Outlining you can refer to this article:https://docs.microsoft.com/en-us/sql/ssms/scripting/code-outlining?view=sql-server-ver15
Multiline statements can achieve the same effect:

195966-1.png
Direct line feeds can create the same effect, You can set it in edit->outline
195817-2.png


0 Votes 0 ·
1.png (4.2 KiB)

If the reply above was helpful please mark as accepted answer so it can be helpful for other community members with same questions.

Regards

0 Votes 0 ·