SQL SERVER – CTRL+SHIFT+] Shortcut to Select Code Between Two Parenthesis

Every weekend brings creative ideas and accidents brings best unknown secrets in front of us. Just a day while working with complex SQL Server code in SSMS I came across very interesting shortcut which I have never used before and instantly fell in love with it. It is totally possible that you are familiar with this but for me it was the first time and I was surprised that I did know know this short cut so far.

Shortcut key is CTRL+SHIFT+]. This key can be very useful when dealing with multiple subqueries, CTE or query with multiple parentheses. When exercised this shortcut key it selects T-SQL code between two parentheses.

Let us see the examples to understand the same. In each of the examples I have put the cursor at the position displayed and pressed CTRL+SHIFT+] and it has selected the code between two corresponding parentheses.

Cursor position 1

Cursor position 2

Cursor position 3

If you are a developer and have to code with complex queries, you will totally appreciate that this feature can save so much of the time for development. I often remember my experience as a developer when I have lost a lot of hours to just balance parentheses. As I said yesterday I found this shortcut accidently. How many of you were aware of this feature? Is there any other useful feature you would like to share with us? Please leave a comment and if I have not covered it earlier, I will share it due credit on this blog.

Reference: Pinal Dave (http://blog.sqlauthority.com)

25 thoughts on “SQL SERVER – CTRL+SHIFT+] Shortcut to Select Code Between Two Parenthesis

  1. Thank you! Very simple but extremely useful. I always end up moving the cursor with the arrow keys since it usually matches the with the corresponding parenthesis. It doesn’t always work to well. I will give this a shot on Monday. Enjoy your weekend.

    Like

  2. Pingback: SQL SERVER – Switch Between Two Parenthesis using Shortcut CTRL+] « SQL Server Journey with SQL Authority

  3. Pingback: SQL SERVER – Weekly Series – Memory Lane – #037 | Journey to SQL Authority with Pinal Dave

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s