You are here
Home > SQL > Customizing SQL Server Status Bar – Know Your Connection

Customizing SQL Server Status Bar – Know Your Connection

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. If you don’t see the Registered Servers tab, hold down Ctrl+Alt+G or select the Registered Servers item from the View menu.

Customizing SQL Server Status Bar

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’.

Customizing SQL Server Status Bar

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.

Customizing SQL Server Status Bar

On the next tab (Connection Properties), browse for and select the database you want to connect to.

Customizing SQL Server Status Bar

I selected my test database here.

Customizing SQL Server Status Bar

After selecting the database, check the ‘Use custom color’ option and click on the Select button to choose a suitable colour.

Customizing SQL Server Status Bar

For my test database, I chose Blue as a nice safe visual sign.

Customizing SQL Server Status Bar

Clicking on OK and saving the settings, you will see the Test database under the registered servers list.

Customizing SQL Server Status Bar

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.

Customizing SQL Server Status Bar

After saving all your settings, you will see both database connections listed under the registered servers tab.

Customizing SQL Server Status Bar

Go ahead now and run a query against the live database by right clicking on the server and selecting ‘New Query’.

Customizing SQL Server Status Bar

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.

Customizing SQL Server Status Bar

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.

Customizing SQL Server Status Bar

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.

Customizing SQL Server Status Bar

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!

TechNet

Dirk Strauss
Dirk is a Software Developer and Microsoft MVP from South Africa. He loves all things Technology and is slightly addicted to Twitter and Jimi Hendrix. Apart from writing code, he also enjoys writing human readable articles. "I love sharing knowledge and connecting with people from around the world. It's the diversity that makes life so beautiful." Dirk feels very strongly that pizza is simply not complete without Tabasco, that you can never have too much garlic, and that cooking the perfect steak is an art he has yet to master.

Similar Articles

Top