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. 

image

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:

output_SYAs9k

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

2015-12-09_20-52-58

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

2015-12-09_20-54-57

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.

image

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.

Leave a Reply

Your email address will not be published. Required fields are marked *