Working with SSMS Tab Management (Quick Ref)
Published 29 October 2019
Tab Coloring
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
Tab History
SQL Prompt's Tab History keeps a history of the query windows (tabs) that you open in SSMS in order to prevent accidental loss of work. If SSMS crashes, or if you close down SSMS without saving your open tabs then, on relaunch, SQL Prompt Tab History will restore the content (T-SQL code) in all the tabs to the state they were in when the last of the above actions was performed. Tab History can also reconnect the tabs to the databases to which they were previously connected.
- Use the tab list filter the 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.
- 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.
- Mouse over each of the tabs in the tab listing column, or use the up and down arrows, to see the code for that tab 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.