Tips ‘N’ Tricks – SSMS – Commonly Used Keyboard Shortcuts in SQL Server Management Studio

In one of the previous tips we saw a Shortcut Way to Invoke SQL Server Management Studio (SSMS). In this tip, we will see some of the commonly used Keyboard Shortcuts in SSMS.

Select an Object (or Text enclosed in Square Brackets)

  • To Select an Object in Query Window, keep your mouse cursor anywhere between first and last characters (including those characters) and press Ctrl+W.
  • The same shortcut works when you want to select any text enclosed between Opening and Closing Square Brackets (“[]“).

Query Commenting

  • To Comment one or more lines of code, select the line (s) of code to be commented and press Ctrl+K followed by Ctrl+C.
  • To Uncomment one or more lines of code, select the line (s) of code to be uncommented and press Ctrl+K followed by Ctrl+U.

Note: Above approach of commenting and uncommenting, add/removes two hyphens (““) in the beginning of every selected line of code and it does not generate multiline comment (“/* */“) with slash (“/“) and asterisk (“*“).

Query Parsing and Execution

  • To Parse a Query, select the query (if part of the query in the query window needs to be parsed, else no need to select the query if everything in the query window needs to be parsed) and press Ctrl+F5.
  • To Execute a Query, select the query (if part of the query in the query window needs to be executed, else no need to select the query if everything in the query window needs to be executed) and press one of the following:
    • F5
    • Ctrl+E

Show or Hide Results Pane/Window

  • To Show or Hide Results Pane/Window, press Ctrl+R.

Navigate between Query & Results Pane

  • To Navigate between Query Pane/Window and Results Pane/Window, press Shift+F6.

All the above Keyboard Shortcuts pretty much work on SSMS version 2005 and above (2005/2008/2008R2/2012). For more Keyboard Shortcuts, visit SQL Server Books Online (BOL).

Take a look at the other Tips and Tricks in this Series on Tips, Tricks, Techniques, and Shortcuts to Improve Productivity, and Design and Coding Skills.

Advertisements

About Dattatrey Sindol (Datta)

Datta is a Microsoft BI Enthusiast, passionate developer, and a blogger. View Full Profile

Posted on May 4, 2012, in Keyboard Shortcuts, SSMS, SSMS Shortcuts, SSMS Tips, Tips 'N' Tricks and tagged , , , , . Bookmark the permalink. 4 Comments.

  1. Thanks for the article, those are great tips!

    However, I do believe there was a typo at the shortcut for commenting out the line: it’s supposed to be Ctrl+K followed by Ctrl+C, not the other way around.

  1. Pingback: Tips ‘N’ Tricks – Tips, Tricks, Techniques, and Shortcuts to Improve Productivity, and Design and Coding Skills « Datta's Ramblings on Business Intelligence 'N' Life

  2. Pingback: Tips ‘N’ Tricks – SSMS – Quickest way to SELECT and Query All Columns from a Table in SQL Server « Datta's Ramblings on Business Intelligence 'N' Life

What are your thoughts?

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

%d bloggers like this: