Change Servers

I found a hacky, but effective way to add a keyboard shortcut to the “Change Connection” toolbar functionality of SQL Server Management Studio. (SSMS) I’m using SSMS 2008, but theoretically these steps can be applied to other versions as well.

1. Right click the toolbar, and Select Customize

toolbarRightClick

2. Click Rearrange Commands

Rearrange Commands

3. Select the Toolbar radio button, and the “SQL Editor” drop down to show the “Change Connection” option we’re looking for.

4. Select the “Change Connection” control, and pull down the “Modify Selection” drop down.

5. Change the “Name” to: “Chan&ge Connection...” (move the ampersand to in front of the ‘G’, and select “Image and Text”. When complete, you should have something similar to this:

ModifySelection

Now, when your Query window has focus, you can simply press “Alt+G” and SSMS will open the “Change Connection” dialog. This works great when deploying the same script to multiple database servers. (e.g. Test and Production)

Change Database

If one is already connected to the desired server, and he only needs to change among various databases, he can use Alt+D to focus on the databases drop down, and type the first couple of characters of the database name. Pressing Enter will return you to the query window so you can continue running / writing your query.