September 28, 2013 Leave a Comment
At the end of my SQL Saturday presentation today on Advanced Common Table Expressions, which is about the 12th time I have presented on CTEs, I was asked a question that I have been asked many times after I present. I am blogging about this because I have been asked about it so many times. This one one of those hidden gems in SSMS that just makes working in SSMS that much easier.
The question was “I have my results and messages showing up below my T-SQL editor in SQL Server Management studio, how do you get it to show up as 3 tabs, one for the editor, one for results and oen for messages.
The default configuration of SSMS your results and messages windows are shown below the query window as shown below:
This configuration is just fine when you are running at a higher resolution, but when you are running at a lower resolution, like most projectors require, it is easier to see what is going on when the Results and Mesages are displayed on separate tabs at the top level as shown in the next two screen shots.
Based on the default configuration, it is not exactly obvious how to do this.
Here is how you do it. From the Tools menu in SSMS choose Options. The following dialog will be shown. Expand the Query Results setting, then SQL Server, then click on the Results to Grid (or Results to Text) depending on your preference. There are two checkboxes that you should check to get the desired behavior. These are highlighed in the image below. “Display results in a separate tab”, and “Switch to results tab after the query executes”. Click both of these then click the OK button. Depending your your version of SSMS you may need to restart it for the changes to start working.
From this point forward SSMS will default to showing the results in a separate tab. For SQL Saturday or other presentations this is a great way to share more of the result set with the audience.