Fixing SQL Server Management Studio’s Tab Text

I hate the way SSMS tabs look by default.  Check this out:

SSMS Tab Defaults
SSMS Tab Defaults

That’s nearly useless.  The tabs are wide, but they still don’t show useful information.  Even worse, I’ve got more tabs than I can fit in the window, so the rest hang out in a meaningless dropdown.

To fix it, click Tools, Options,and go into Text Editor, Editor Tab and Status Bar.  Check out the Tab Text options:

Tools, Options
Tools, Options

You can uncheck the database name, login name, and server name because those are shown in the status bar anyway.  Then, if you wanna get fancy, change the status bar location to Top – it’s right above the Tab Text options.  Voila:

SSMS Tabs Fixed
SSMS Tabs Fixed

When I’m working, I save my queries in c:\temp with a short descriptive name.  If I’m performance tuning, I’ll save them as Before.sql and After.sql, or maybe Index1.sql and Index2.sql.  Presto, I can easily switch tabs without playing the guessing game.

Free, 3× a week

Get my new posts by email

Three posts a week, plus a Monday roundup of the best database news from around the web.

88 comments

  1. Hi Brent

    What would be great is a way to write a macro which would detect when the currently active database or server is on a predefined list – and if it is, change the background color of the query window. That’d be great as a warning that you are on a production database for example.

    1. Another option for colors is when you are logging in to the server, hit the “Options >>” button on the bottom right, go to “Connection Properties” tab and check “Use custom color”. Select a color. Now when you connect, the status bar (the one you just moved to the top of the editor 🙂 ) will be that color.

      This setting is associated to the server you are connecting to, so it’ll remember the color next time you log in, and if you have different tabs open connected to different servers, the status bar will be the correct color on each of your tabs.

    1. Ramon – yeah, you should be on the latest version of SSMS at all times even if you’re connecting to SQL Server 2005. SSMS 2008 R2 has a lot of nice improvements like this.

      1. Except that the SMS 2008 activity monitor doesn’t work against SQL 2000 servers (plus, I don’t think its as useful as the SQL 2005 activity monitor). If someone made a “classic activity monitor” plugin for SMS 2008, I’d be all over it!

  2. You put your taskbar at the top too!!! How weird!

    I did not know that you could remove the database name from the tab, or that other stuff too. Now I do.
    Thanks

    1. Task bar on the top very handy. All controls in the same place, don’t need to move move though whole screen to manage windows.

  3. Never dawned on me that you could tweak the UI this way, although it did annoy me that the text in the tabs is useless.

    Now if I can find a better way to manage my script library. I would like to create several “Queries” folders to categorize my scripts, but SSMS doesn’t allow that (at least not that I have found). 🙂

    Thanks for the tip!

      1. Thanks. I’ll check it out. Typically I save my files to a thumb drive and not a network drive.

        Maybe I am missing something since you obviously think not being able to save to a network drive is a short coming?

        Could you elaborate?

        1. Yeah, when you’ve got multiple people in a shop (developers and DBAs) it’s much easier to have a centralized set of scripts that everyone can update seamlessly.

    1. Great tip, Brent…

      But I REALLY want to thank Jerry. It’s been driving me nuts that I didn’t have a shortcut to Change the Connection.

      Thanks a million!

      –Brad

  4. Cool tip Brent! I thought I had been through every knob and dial in SSMS, but I have never seen/used those options.

  5. Good suggestions.

    But, I’m not sure I’ll get into the habit of saving all the scripts into files.

    I’d much rather have the option of dynamically entering the tab text and/or highlighting part of the script (the key statement or part of a comment) and in the context menu (right-click) having a “Label Tab” option (or something like that) to change to tab text to that string.

      1. Thanks, Brent.

        I haven’t, but with your encouragement I went over there and found this entry:

        http://bit.ly/kT41qy

        Seems like changing the tab labeling would requiring overriding the default visual studio behavior, and they don’t seem to want to (as of a month ago). Somebody else suggested more flexible tab labeling in the comments there.

        I doubt I could get them to reconsider, but perhaps you could…

  6. Thanks for a great tip, Brent. It’s probably worth mentioning for the uninitiated that you have to restart Studio before Options changes take effect. (They should add an option to change that!)

  7. Really nice tip! Sadly, I’m stuck with SMSS 2005 for the moment. Anyone knows if it’s be possible to do this via registry?

    Another thing. I actually came here looking for a way to change the way new tabs are created in SMSS: They appear at the left, pushing all existing tabs to the right, which I find immensely annoying. I think they should appear to the right, just like any browser. Is this possible?

  8. In ssms2012 unchecking the server name results in the ssms crash. (Each time when query is opened and closed without any save/execute action in between).

  9. Sadly, I can’t get rid of the leading server name when designing views in SSMS 2008 R2, despite unticking this option. Go Microsoft. Oh well, at least I can now see more info on the right hand side – so now it’s only half useless.

    I still think SQL 2000 had the best UI – that just worked. Good luck trying to find deadlocks in current versions.

  10. Brent,
    Very practical and useful tip. Also your bolg post gets lots of good responses and I learn from them as well. Thanks everybody for sharing your ideas.

  11. This is nice tip, i didn’t look this option till now. Actually this helped in different way in my case though. I just displayed only file name and server name on tab, that way i could see server name always.

    Thank you.

  12. so I stumbled into a related shortcut today… I’ve been using the “Windows…” command in my toolbar for quite a while, but it still doesn’t quite mimic the window list that the old Query Manager had. I’m not sure if it’s much better, but when I added the “File List” command to my toolbar, A) it is displayed with the name “Show EzMDI File List”.. and B) it shows a hotkey shortcut of CTRL + ALT + Down Arrow.

    So did everyone else already know about the CTRL+ALT+Down thing? The fact that the list always shows up in the upper-right is a bit annoying, but it’s easier to read than the tabs! Just press that, then the down arrow a few times to select one, then enter. bam! 13 years later and we’re almost back to year-2000 usability. Now if we can only get a useful version of the Activity Monitor 😉

  13. Hi Brent,

    Thanks for this tip.

    Just want to throw an issue to see whether you have any ideas.
    Is there a way to have a convenient hot key combination for comment/un comment.

    I was used to,
    CTRL+SHIFT+C – Comment out code.
    CTRL+SHIFT+R – Remove comments (UNCOMMENT)
    combination in SQL Server 2000.

    The current combination of
    CTRL+K, CTRL+C /CTRL+K, CTRL+U need two key presses and inconvenient.

    Thanks,

    Sena

    1. Hey Sena,

      I actually like the current shortcuts for this! I find it easy ever since I learned a mneumonic device for it from Merrill Aldrich (http://sqlblog.com/blogs/merrill_aldrich/)

      Control Kansas + City

      And then the “U” the other way is almost like “undo”. For some reason this really made it easy for me. It’s definitely an american version but I bet there’s a different city name to localize it for other parts of the world.

      Just a simple idea. 🙂

      Kendra

  14. I would really like the tab name to be the first x number of characters of the first line of the query. I normallyy put a short comment / description there and I don’t want to save all my queries

  15. Great tip !!!
    Is there a way to also apply these settings to the Query Designer windows?

    For example, when you right-click on a table name, and pick “Edit Top 200 Rows”.
    The window that comes up (which I believe it’s referred to as the “Query Designer” window), does not see to pick up these settings.

    Thank you very much.

  16. This thread is old, but have you noticed that in SSMS 2017 they have removed the “executing” text from the tab? Now I have to click back through each tab to see if it’s still running or if it finished! LOL Silly Microsoft.

    1. Jacob Golden – did you by any chance figure out how to get it back? it is so frustrating to keep going through all my open tabs!

  17. I tried this on ssms v17.3. but everytime I execute a table or stored proc it gives me the filename as only sqlquery1.sql / sqlquery2.sql and not the file name. My filename has schemaName.ActualFileName format.

  18. Thanks…this is a great help ..especially working with multiple databases.
    I wish they would let you just increase the width of the tab…

  19. Anyone else select “False” for include server, login, and/or database name and they still show on the tab after restart? I am wondering if it has something to do with the DB Forge (SQL Complete) add on that I am using, because mine will not go away.

    1. Make sure you’re in the “Tab Text” section, and not the “Status Bar” section. I may or may not have learned this firsthand 🙂

  20. I submitted this to Microsoft on https://feedback.azure.com:
    Request title:
    SSMS add a pane with a vertical list of open queries
    Description:
    In SSMS add a pane with a vertical list of open queries similar to the Object Explorer pane that can be docked/undocked that you can see the entire file name and quickly navigate or choose from the entire list of tabs of open query files to choose from.
    So, instead of horizontal tabs where the file name and other details that are partially hidden or don’t appear if many files are open, have an option to show a vertical list of open files.
    Add ability to pin so that the pinned ones go to the top of the vertical list.
    It should look like the list of Files in the Solution Explorer but only open files.
    There is at least one third party company selling a plug-in but who has money for that…

    1. I know that on the very right edge of the horizontal list of tabs, there is a drop down arrow that shows the list of tabs vertically but I’d like it to be able to dock like Object Explorer, Registered Servers, etc.

    1. Have loved redgate sql prompt for years, with it it is easy to collercode tabs and make them persistant when closing SSMS.
      Have made my work much easier.

  21. I wish we could just name the tab without having to save the file (which changes the default location for saving scripts).

  22. Microsoft recently granted your wish. In SSMS 21, you can do this by right-clicking the tab and selecting, “rename.” This is only available for unsaved queries: For saved queries, the filename takes priority.

    1. Just saw this, thanks! Of course, they waited for me to retire before doing this. But, better late than never, I guess.

Leave a comment

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

Email me about new comments: