Customizing SQL Server Status Bar – Sometimes I work on a server that has live databases mixed in with test databases. You can obviously see the problem here. Let’s delete some test data. Oops, wrong database. Well there is a solution. SQL Server Management Studio allows us to identify the connection. You do this by changing the colour of the status bar below the SQL Query Window. Customizing SQL Server’s Status Bar is so easy, it is again one of those tricks I never knew existed. It is ‘hidden’ in plain sight though and adds a lot of value to your productivity.
Customizing SQL Server Status Bar
I am using SQL Server 2008 R2 and I am going to make use of Registered Servers.
Looking for something else? Try these links instead:
- Shrink Bloated Development Databases – Save Precious Space
- Query Stack Overflow With T-SQL – Give Your Queries A Workout
- Script Table Data In SQL Server Management Studio
- Prevent Accidental Table Data Deletion In SQL Server Management Studio
If you don’t see the Registered Servers tab, hold down Ctrl+Alt+G or select the Registered Servers item from the View menu.
What I am going to do is add a new server registration. To do this, right click the Local Server Group and click on ‘New Server Registration’.
New Server Registration
The New Server Registration window opens up and from here you can see a few options. First off, select the correct Server name. Define your authentication type and if you want to, change the Registered Server name to something more friendly. I changed mine to reflect the database I would be connecting to.
On the next tab (Connection Properties), browse for and select the database you want to connect to.
I selected my test database here.
Using a Custom Color
After selecting the database, check the ‘Use custom color’ option and click on the Select button to choose a suitable colour.
For my test database, I chose Blue as a nice safe visual sign.
Clicking on OK and saving the settings, you will see the Test database under the registered servers list.
Now for the Live Database
Next we will follow the exact same procedures for the live database. This time we will choose a more visually demanding colour such as red.
After saving all your settings, you will see both database connections listed under the registered servers tab.
Go ahead now and run a query against the live database by right clicking on the server and selecting ‘New Query’.
You can see that the status bar is highlighted with the colour red. If this isn’t an indication to you that you need to be careful, I don’t know what is.
Running a query on the test database, you get a nice soothing blue status bar indicating that everything is groovy. You can run a Bobby Tables against this database and you won’t end up being fired.
On a Server Level
Lastly, if you want to define this type of status bar colour functionality for queries on a server level, just click on the Options button when logging on. This will then allow you to configure the same options as above.
Once again, SQL Server Management Studio has surprised me with it’s awesome customizability. I am even more surprised that I never thought of looking for such an option to begin with. Just goes to show, you are never too old to learn. Happy SQL-ing!