This web site uses cookies. By using the site you accept the cookie policy.This message is for compliance with the UK ICO law.

SQL Server
SQL 2008+

SQL Server Connection Colours

SQL Server Management Studio allows multiple concurrent connections to different servers and instances. This can be risky when connecting to live, test and development systems at the same time.

SQL Server Management Studio

SQL Server Management Studio (SSMS) provides a set of tools that you can use to manage your SQL Server instances and databases, including script windows where you can execute Transact-SQL statements. One powerful feature is the ability to connect to multiple SQL Server instances at the same time. This can lead to the risky situation where you have script windows open for live databases and development systems, making it easy to execute a damaging script against the wrong database accidentally.

Although every script window shows the connection details in its tab, the area is small and connections with similar details can easily be mistaken for one another. To alleviate the risk of using the wrong database, a more visible option is to change the colour of the status bar. When making a new connection, you can specify a custom colour that will be applied to the status bar for any script windows. For example, you could use a red status bar for live connections, green for test and blue for development systems.

To set the colour, you use the Connection Properties section of the Connect to Server dialog box. This tab includes the option, "Use custom color". To set a colour, tick the checkbox and then click the button to the right of the option. A colour picker dialog box allows you to make your selection.

SQL Server Management Studio Custom Color option

After choosing a colour, connect as normal using the Connect button. Click the New Query button to open a new query window. You should see that the status bar's background appears using the chosen colour. Try making a second connection to another SQL Server instance and selecting a different colour. When you create script windows for this connection, the status bar will use the second colour. As you switch between windows, the colour can give a visual indication of which connection you are using.

SQL Server Management Coloured status bar

20 March 2016