Working with SSMS Tab Management (Quick Ref)
Published 09 September 2019
The Tab Coloring component of SQL Prompt’s SSMS Tab management will color-code row of tab labels along the top of an a query pane in SSMS, and the status pane at the bottom of each query tab. These will help you to see immediately to what server, or type of server, each tab is connected. The colour of the tab that you choose is bright, if it is the current tab, or darker if it isn’t. There are several ways that you can map each of your servers or databases to your chosen color for that category of environment. The most intuitive way is to right-click on the server or database in the browser pane, but you can also do it for servers, or groups of servers, from the local Registered Server groups browser, or the Central Management Servers browser.
The Tab Color (Group) option is for when you are working on a query pane that will need to connect to several servers in a group. The assigned environment color only takes effect for query tabs opened directly from that group. Having assigned the group to Development (say), if you then open a query tab and connect it to an instance, the tab won’t be green; it will be the default color, or whatever color is assigned lower down in the hierarchy, at the server or database level.
However, if you use the setting Tab Color (Servers in Group) option instead, or as well, then any query tab connected to an instance in that group will inherit the specified color, unless you then override it at the individual server or database level.
The cleanest way to do it is make your assignments at the highest level possible, and then leave everything else set to Default. For example, set the environment at the Registered Server Group level and then make sure Tab Color (Server) is set to Default, for each server in that group, and then that Tab Color (Database) is set to Default for each database on each of those servers.
You can do the editing of all the tab color assignments within SSMS, using SQL Prompt’s Options > Tabs > Color window. It is in this window that you can delete assignments, which is the same as setting them to Default
If SSMS crashes, or if you just close down SSMS recklessly without saving your open tabs then, on relaunch, SQL Prompt Tab History will restore all the tabs you had open when SSMS was last alive. The application saves all the T-SQL code, just as it was before you closed or lost it. Tab History can also reconnect the tabs to the databases to which they were previously connected.
You can filter the list of to show all tabs, or only open, or only closed tabs, and switch between the views simply by hitting the Ctrl+Right Arrow and Ctrl+Left arrows.
You can see that the tab list shows the file name, if you ever saved it, and the SQL Server to which the tab is or was connected, and the environment to which that server belongs, as defined by your Tab Color configuration.
Just mouse over each of the tabs in the tab listing column, or use the up and down arrows, and the code for that tab will appear in the right-hand pane. At the top right of the code preview pane, you’ll see the time the tab was closed if you ever closed it, and in the bottom right you’ll see the database, as well as the SQL Server to which it was connected.
Type into the search bar anything significant you can remember about the ‘lost’ code in order to help you find specific code.
Once you’ve found the code you want, click on it, in the tab listing, or just hit enter, and the SQLQuery20.sql will be restored as an open query pane, with nothing lost, and you can save it.