How to find the appropriate start and end statements in SQL Server management Studio 2012?

How to find the appropriate start and end statements in SQL Server Management Studio 2012? I have a very long stored process with several levels of multi-page nested if statements. SQL is already formatted. My question is very similar to this one , but I'm using SSMS 2012, which is now using Visual Studio Shell. I was wondering if MS added this functionality or if there is an external tool or SSMS plugin that does this.

Otherwise, I will have to resort to decisions on the old question.

+11
source share
5 answers

If someone is still looking for an answer to this question, this is CTRL +].

+21
source

It seems I can get code collapse for BEGIN / END without any problems. Follow my settings under Tools> Options> Text Editor> Transact-SQL:

enter image description here

Please note that I have IntelliSense enabled with verified "contour statements" in the menu "Tools"> "Options"> "Text Editor"> "Transact-SQL"> "IntelliSense":

enter image description here

Line numbers really help. If I hide the line containing BEGIN, the next line number is next after END:

enter image description here

+9
source

This is not an answer, I do not have enough reputation for comment.

Besides the solutions mentioned in another topic that you talked about, I don't think there is a way. What am I doing, delete END , write END again, it will be gray, and the BEGIN that matches this END will also be gray. Then I just look at the code for gray words.

+3
source

The function you need is called Edit.GotoBrace and is present in SSMS v 2008, as well as in 2012. It has different shortcuts, depending on the language version of your ssms. I have SSMS2008 EN and SSMS2012 German, my keyboard layout is German. So shortcuts:

SSMS 2008 EN

Just find the right start / end

Edit.GotoBrace Text Editor::Ctrl+ยด

same but also expand selection

Edit.GotoBraceExtend Text Editor::Ctrl+Shift+ยด

SSMS 2012 German

Edit.GotoBrace (Bearbeiten.GehezuKlammer) Text-Editor::Ctrl+ยด

Edit.GotoBrace (Bearbeiten.GehezuKlammer) Text-Editor::Ctrl+9

Edit.GotoBraceExtend (Bearbeiten.ErweiternbisKlammer) Text-Editor::Ctrl+Shift+ยด

Edit.GotoBraceExtend (Bearbeiten.ErweiternbisKlammer) Text-Editor::Ctrl+Shift+9

In SSMS 2012, you can use your own keyboard shortcut manager to view / change the shortcut for this or any other command. But: The Native team has one drawback: you have to be at the beginning / end to go to the pair token.

I developed a free add-on for ssms and yesterday I implemented an improved function that allows you to jump to the parent begin / end tag from any position in the embedded code. It will be available in a future release. Therefore, if you like my idea - wait for the next release. The add-in is called SSMSBoost. I also used it to quickly find the answer to your question: - it has the "Dump SSMS Shortcuts" and "Dump SSMS" commands, which makes a complete list of all available functions in ssms (and allows you to rebuild shortcuts in SSMS2008, where there is no shortcut manager)

+1
source

CTRL + ] to go from BEGIN to END compliance. The same key to go to BEGIN from END .

CTRL + SHIFT + ] to select a block of code when switching between BEGIN and END .

If you installed the SQL query by clicking BEGIN ( END ), highlight the corresponding END ( BEGIN ) in gray.

+1
source

All Articles