Say that three times fast!
The SQL 2008 client has a cool, yet obscure, feature that enables you to have quick visual feedback on what server you are connected to. This is a long overdue addition for most of us who manage multiple servers and typically have many windows open connected to various servers. For years, I have perfected the 2 second hover, where I instinctively hover my mouse over the execute button (or my finger over F5) and make sure I am connected to the intended server before unleashing that mass update/delete query.
To do this, go into your registered servers (Ctrl+Alt+G) and right-click a server and choose properties from the menu. Select the “Connection Properties” tab and at the bottom you will see the “Use Custom Color” checkbox.
Once you define this, connect to that registered server. Create a new query window, and voila! You have a nice color-coded status bar at the bottom indicating easily what you are connected to. It should look something like below:
If you have a small number of servers you can have a different color for each server. If you have many you will probably want to color-code them by groups like: developer machines, development servers, stage/test servers, production servers. This just might save you from accidentally executing that mass update query you were testing against production!
Alas, nothing is perfect though. I have found quite an annoyance with the implementation of this. This works great if you create a new query window, but in other ways … not so much. Below are the gotchas I have noticed:
- It does not work when editing objects! So if you right-click a stored proc and choose “Modify”, you would think that the window would be color-coded to the server you are connected to in Object Explorer but that functionality is missing. I am shocked that this doesn’t work.
- If you are opening files, the functionality is based on the active query window in SSMS. That means double-clicking or drag-n-dropping a file will use the properties of the active window, if it is color-coded green then the file you opened will use the same connection and be color-coded green as well.
- If you use the right-click “Connection->Change Connection” functionality in the query window, it is even more retarded. It changes the connection but keeps the previous connection’s color!
This is a very good idea implemented poorly. If Microsoft can iron this out to where color-codes are consistently applied, this feature could prevent accidental damage all over the world … a good first step towards world peace!

