Using New Horizontal/Vertical Tab Groups

9

January 14, 2013 by Kenneth Fisher

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.

9 thoughts on “Using New Horizontal/Vertical Tab Groups

  1. Jason A. says:

    Kenneth,

    Thank you for pointing this feature out! I have a tendency to connect to a couple instances at once, usually for testing a script on different versions of SQL, and have ALWAYS had a hard time keeping track of which tab is which instance.
    Splitting the tabs between instances will make this FAR easier!

    Jason A.

    • Glad you liked it. Tab groups had seemed like one of the less useful features of SSMS until I thought of using it this way. I’m sure there are even more useful things I just don’t know anything about 🙂

  2. vikas pathak says:

    Thank you very much Kenneth!

    Really it’s helpful for me. Earlier I used to open multiple SSMS on my system in this scenario.

  3. Keith Macdonald says:

    Good article, just wondering how to enable the drag and drop. My instance of SSMS has it disabled. Probably a security setting, if I only knew what and where it is (doh) 🙂

  4. G-Dub says:

    Good article. I use vertical tab groups when developing new queries. I build piecemeal, and I use the left pane for the main query, and the right pane for exploratory queries and/or testing code. When juggling large numbers of queries, it’s also possible to open multiple instances of SSMS, though I try to avoid this because I’m concerned about possible resource consequences. Anyone aware of any serious downsides to using multiple SSMS instances?

    • The only issue I’m aware of with multiple SSMS instances is the resource consequences you mentioned. I work on a somewhat resource constrained machine and multiple instances of SSMS do degrade my performance somewhat. Particularly if I’m doing queries with large result sets.

      • G-Dub says:

        Thanks. I think the large result sets may be an issue whether in tab groups or separate instances.

        • It certainly can be. The main benefit of using tab groups over separate SSMS instances is the overhead of SSMS. The result sets are stored in memory (as far as I know) so if you have several queries that pull large result sets you are going to hammer the available memory on your workstation. If I do a query that has a large result set I try to clear at least the result set as soon as possible by running a simple query, maybe a USE statement.

  5. […] you right click on a tab you’ll see a number of different options. You can set up new horizontal or vertical tab groups, pin tabs, close tabs etc. But in this particular case take a look at these […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 3,755 other subscribers

Follow me on Twitter

ToadWorld Pro of the Month November 2013
%d bloggers like this: