During my SQL Saturday Birmingham Presentation on SQL Tips and Tricks, one of the productivity feature which got lot of love from most of the attendees was the use of custom colors to differentiate between SQL environments.
At work, generally we have to shift between different environments within SQL Server Management Studio – Local/DEV/QA/MOCK/PROD, resulting in the creation of multiple query tabs – with each query tab connected to different environments. This often becomes unmanageable and difficult to keep track of.
Think about a scenario when you have a data manipulation script to be executed in different environments, isn’t it a big advantage to have a visual differentiation between the environments you are executing your scripts against?
SSMS provides us with an ability to set different colors for connection to separate environments. Personally, I prefer to set the below colors for my environments —
PROD – Red,
MOCK – Orange,
QA – Yellow,
DEV – Blue and
Local – Green
The color is displayed in the SSMS status bar, at the bottom. Hence when you connect with a particular environment, it uses the same assigned color. This presents a visual indication of the environment in which you are running your scripts.
SELECT ‘Local DB for Update/Delete/Insert’ AS ‘Environment’
SELECT ‘DEV DB for Update/Delete/Insert’ AS ‘Environment’
SELECT ‘PROD DB for Select’ AS ‘Environment’
When you are connecting to a SQL Server instance, you will need to click on the ‘Options’ button:
Then click on the ‘Connection Properties’ tab and you can choose a custom color for your environment:
Once you select a color for an environment, every time you login to that SQL Server instance – it will display the same color in the SSMS status bar. For developers running data manipulation scripts, it’s always nice to have a visual indication of the environment you are logged in – especially a RED color in your SSMS query editor, indicating you to be extra cautious.
To learn more SQL Tips and Tricks & other Productivity Enhancements in SQL Server Management Studio, please refer my article links below —