Wednesday, February 1, 2012

Show/Hide Results Pane – SQL Server 2008

A few years back I wrote an article about doing this same thing in SQL Server 2005.  All the images from the previous post were somehow lost, and since the instructions are basically the same for SQL 2008 I thought it would be a nice refresher.

One of the simplest and most useful features when debugging a sql script is to be able to run your query to see some results, then hide the results pane to continue tweaking your sql code. This feature was a button on the toolbar in Query Analyzer in SQL Server 2000, but for some reason it has been missing in SSMS (SQL Server Management Studio) since 2005. Well, the button may not exist by default, but it's easy to add it in.

This is what we are striving for, a button on the SQL Editor toolbar that says either "Show Results Pane" or "Hide Results Pane":


To add a button to hide the results pane:

1. Click on the little down-arrow at the end of a toolbar and choose "Add or Remove Buttons", then choose "Customize...":
Add button to Toolbar


2. The Customize dialog window will open with the "Commands" tab selected. Now we only need to find the command we are looking for. Under "Categories:", choose "Window". Then under "Commands:", find the command "Show Results Pane":

Choosing the "Show Results Pane" command from the menus


 3. Once you have located the "Show Results Pane" command, you have to click and drag it to where you want it to be located on the toolbar:

Starting the drag


Placing on toolbar



End result after placement

Originally I had my button located on the Standard toolbar, but eventually I figured out it made more sense to add it to the SQL Editor toolbar. It's pretty easy to find the SQL Editor toolbar - it only displays when you are working in a query window.


Here is the end result again:

Notice the button says "Hide Results Pane" when the results pane is showing:
"Hide Results Pane" Button


Also notice that the button says "Show Results Pane" when the results pane is hidden:
"Show Results Pane" Button




No comments:

Post a Comment