Search This Blog

Sunday, March 6, 2011

SSMS RTFM findings

Using other database client tools like SQL*Plus I learned the ins and outs of it, but with SQL Server Management Studio (SSMS) it is much more complex with things hidden in plain sight. For the first case in point, templates and the shortcut CTRL-Shift-M. What is so great about that? Well we can have scripts that makes use of a template and we press our the magic key stroke, we can fill in the variables in the template and then F5 to execute.

Templates hiding from your view, press CTRL-ALT-T and presto they appear. Take note, there are quite a few that Microsoft has included. These can be used or create your own and save the SQL script to C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\SqlWorkbenchProjectItems\Sql for SSMS 2008.

Object browser hiding try pressing F8 in SSMS to bring it back into focus.


Want a new query window to start with the same set of statements each time you open a new query? This is easy once you find the file to edit. The file is 'SQLFile.sql' and is located in the directory C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\SqlWorkbenchProjectItems\Sql

Edit this file and save it, and then each new query window opened will have you favorite text / commands in it.


Some  other useful key strokes are
  • CRTL-F for find and replace
  • CTRL-G for go to specific line number
  • CTRL-K,CTRL-W for bookmarks these are really helpful when looking at long SPs
  • CRTL-I for an incremental search
In fact there is a great list of these at http://msdn.microsoft.com/en-us/library/ms174205.aspx

Learning how to use the envronement effectively will make you more productive and be very helpful when working with others during troubleshooting.

No comments:

Post a Comment