SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Using New Horizontal/Vertical Tab Groups

This isn’t really one of those features of SSMS that I’ve used a great deal. At least didn’t until recently. For those that don’t know, if you right-click on the tab of a query window you will get, among other things, options for a new tab group.

New Tab Group 1

If you pick for example New Horizontal Tab Group you will get this:

New Tab Group 2

I’ve circled the original tab group in red and the new one in blue.

Up until recently the only use I have found for this is to compare two scripts. Put one in the first tab group and the other in second tab group and manually scan through them both.

In the last couple of weeks I’ve started doing some work for a group that I haven’t dealt with before and things are bit different from what I’m used to. First of all their expectations are a bit quicker than our usual customers. Instead of having an expectation of 4-6 hours to get a relatively simple request done, their expectations are closer to an hour or less after they make the request. On top of that instead of getting one script to run, they tend to present me with groups of scripts to be run on a given database, sometimes in a specific order, sometimes not.

Now I’m one of those people who keeps most, if not every script I work on throughout the day open until the end of the day. Not the most efficient thing in the world I realize, but I’ve had too many occasions where I’ve NEEDED one of those scripts from earlier in the day. So recently I had a situation where I had about 15-20 scripts open, and then was asked to run 20-30 more scripts, each one in its own file. Trying to open, review and execute them all, in and among my existing open scripts could have gotten really really messy.

I found though that if I opened up a new tab group with a query window connected to the server/database that I needed. Then dragged and dropped my new files (containing the scripts) into that tab group. Then all the new files opened in the new tab group and where not only connected to the server/database I needed but stayed separate from the rest of what I was working on.

I’m going to walk through this with a couple more images since I think it’s a bit confusing the way I’ve described it.

Use the image above for the starting point. I’ve got 2 tab groups. The top one has all of my old scripts and the bottom one has one empty query window. I connect that query window to the server and database that I need.

I’ve scripted out all of the stored procedures for Adventureworks2008 as an example. I open the folder with all of the scripts and select them all.

New Tab Group 3

And then drag and drop the group into the new tab group.
New Tab Group 4

By dropping the files on a query window they will be opened not only in that tab group but connected to the same server and database. Now I can review, execute and close each of the scripts in the tab group quickly. Cntrl-E to execute and Cntrl-F4 to close the query window once I have a successful run. I don’t have to worry about mixing up the scripts I need to run with the ones I’m working on for someone else. Not to mention that once I run out of scripts in the tab group I’m done.


My name is Kenneth Fisher and I am Senior DBA for a large (multi-national) insurance company. I have been working with databases for over 20 years starting with Clarion and Foxpro. I’ve been working with SQL Server for 12 years but have only really started “studying” the subject for the last 3. I don’t have any real "specialities" but I enjoy trouble shooting and teaching. Thus far I’ve earned by MCITP Database Administrator 2008, MCTS Database Administrator 2005, and MCTS Database Developer 2008. I’m currently studying for my MCITP Database Developer 2008 and should start in on the 2012 exams next year. My blog is at www.sqlstudies.com.


Leave a comment on the original post [sqlstudies.com, opens in a new window]

Loading comments...