This article describes how to set a custom connection color to a query tab in Microsoft SQL Server Management Studio (SSMS) using a feature called Tab coloring in ApexSQL Complete.
Tab coloring can set custom connection colors for individual instances of SQL Server, down to the database level. The user has ability to assign SQL servers, and databases to a specific environment to help quickly identify which connection a tab is currently using.
To associate a query color with a specific server node, go to ApexSQL Complete main menu in SSMS, choose Options from the submenu, and then select the Tab coloring tab:
Under the Tab coloring tab, select an avaiable SQL Server instance from the right Server drop-down box:
The list of available SQL Servers in the drop-down box depends on the list of SQL Servers connected to in the Object Explorer. Make sure that there is at least one active connection, or the Server drop-down list will be empty
When a server is selected, the Database drop-down box shows all avaiable databases for that specific server. From here, the user can either select a specific database for which an environment will be assigned or simply assign to all databases by choosing the All databases at the very top of the list:
The Environment drop-down box has five built-in color presets for each environment. From here, the user can choose between Development, Local, Production, Staging, and Testing environment:
Once the Server, Database, and Environment are set, the final step is to click the Add button and the newly created tab coloring rule is added to the list:
When a new tab coloring connection is added, and the Cancel button or the close (x) button is clicked in the Options dialog, then the newly added connection will be discarded. Make sure to click the Save button after adding the connection, or the OK button in the Options dialog if you want to close the dialog
From now on, all tabs connected to the AdventureWorks2012 database, on the DESKTOP-MQH0VFT\SQLEXPRESS server will be colored green, indicating that the active connection is to the Development environment:
Tab coloring feature helps users who frequently work on many different servers and databases simultaneously by giving them a better overview of which connection they are currently using:
To delete a tab coloring rule, simply select the rule from the list and click the Delete button:
A confirmation dialog box will appear that asks if the user wants to proceed with the action. Just click the Yes button, and the rule will be removed from the list:
To change server, database, or environment for a connection, select a tab coloring connection rule from the list, from the drop-down boxes make needed changes, and then click the Save button to apply them:
To edit environments and colors, click the Edit environments button and a new dialog will open showing the five built-in color presets for each environment:
To change the color of an environment, click any color from the Color column and the Color picker dialog will pop-up:
Pick any predefined basic color from the grid for the selected environment, or click the Define Custom Colors button for more options:
Note: Color grid won’t reflect these changes until the next release, version 2017 R8.
To create a new environment, click the New button and enter a name under the Name column, Optionaly, change the default white color to any other following the previous step:
To delete an environment, select one from the list, and then click the Delete button:
A confirmation dialog box will appear that asks if the user wants to proceed with the action. Just click the Yes button, and the environment will be removed from the list:
If the selected environment is currently assigned to a server or database connection, the following warning message will appear:
Q: Where are the Tab coloring settings stored?
A: The Tab coloring settings are stored in the Options.xml file that can be found at the following location: C:\Users\<user_name>\AppData\Local\ApexSQL\ApexSQLComplete
Q: Can I edit the Tab coloring settings outside the host application (SQL Server Management Studio and Visual Studio)?
A: Yes, as the setting are stored in the Options.xml file, you can use a simple text editor to preview and edit settings.
Information about environments is stored between the <GlobalEnvironments> tags:
Information about Tab coloring connections is stored between the <GlobalTabColorings> tags:
Q: If I click the Defaults button what will happen with tab coloring connections that I’ve created?
A: Loading defaults does not effect user defined tab coloring connections and colors.
Q: There was an update available, I downloaded it, and during the installation process it says that previous versions of ApexSQL Complete will be removed from my computer. What will happen with tab coloring connections that I’ve created?
A: The update process does not effect user defined tab coloring connections.
Q: Can I copy tab coloring settings to another machine e.g. share them with my colleagues?
A: Yes, you can use the Export option in the Options dialog and save all user settings to an .xml file that can be imported on any machine where ApexSQL Complete is already installed. Bear in mind, this option saves all user settings, not only Tab coloring.