Secrets Of the SQL Server Ninja*

I spend more of my day than I’d prefer inside of SQL Server Management Studio trying to piece together fragmented business logic.   However, this does have it’s upside as I’m learning a whole new skill set that I had been ignoring for most of my career. 

One of the major things I’m learning is how to leave the mouse alone.  In Visual Studio, with your trusty Resharper side kick you can fly along, rarely touching the mouse.  I don’t have any of the cool add-in’s available for the SQL Server tools, but I’m starting to get pretty proficient with the basics that are available.

The first and most basic lesson is that just like Visual Studio, F5 means run.  By default, every SQL statement in your current window will execute, but you can short circuit this by highlighting just the block you want to run. 


A lot of times, you’re going to want that value you just looked up so you can copy/paste it somewhere else.  Hands off the mouse!  F6 will toggle between the SQL pane and the Results and Messages tabs:


By default query results are shown in a grid with column headers.


But occasionally, you need your results as plain text.  To toggle this, you can use ctrl+T


And every once in a while you want to save the results to a file.  The shortcut here is ctrl+shift+F.   When you run the query in this mode, you will get a File Dialog asking you where to save the data which will be saved as a .rpt file which you can view in any text editor.


To switch back to the grid view use ctrl+d .  An easy mnemonic here is gridtext and file.


*fat toddler in a Power Rangers costume.