Thursday, June 01, 2006

SQL Management Studio Short Cuts

I have been working with SQL Management Studio (SMS) a fair bit lately. Like most developers I always look for the standard short cuts that I used on Query Analyser. Below are a few of my favourites.

Commenting

I use these short cuts all the time to comment large sections of code. The comment style I prefer the most is dash form which I prefer too the slash style. -- Dash Comment /* Slash Comment */


  • To comment in SQL management studio you must now do Ctrl+K, Ctrl+C instead of Ctrl+Shift+C in Query Analyzer.
  • To uncomment in SQL management studio you must now do Ctrl+K, Ctrl+U instead of Ctrl+Shift+R in Query Analyzer.

Formatting

  • To indent a block of code Select the code you would like to indent and press TAB to indent
  • Shift+TAB to un-indent your code
  • Word Warp long strings with Ctrl+E, Ctrl+W
  • Make Uppercase Ctrl+Shift+U
  • Make Lowercase Ctrl+Shift+L

Bookmarks

Ok so you are working on a massive script that travels for miles. Well then you better be using book marks to navigate that code. Bookmarks are great for moving through scripts and trouble shooting. Try out the following the next time you are working on a big script.


  • Toggle Book Mark on/off and Crtl+K, Ctrl+K
  • Enable all book marks Crtl+K, Ctrl+A
  • Move to next bookmark Ctrl+K, Ctrl+N
  • Move to previous bookmark Crtl+K, Ctrl+P
  • Move to next bookmark folder Ctrl+Shift+K, Ctrl+Shift+N
  • Move to previous bookmark folder Ctrl+Shift+K, Ctrl+Shift+P
  • Clear book marks Ctrl+K, Ctrl+L