Thursday, January 17, 2013

Make a SQL Server Shortcut to Change Database Connections

In SSMS, to change databases most people do one of the following:
1. Click the Change Connection toolbar button
2. Right click anywhere in the query pane -> Connection -> Change Connection
3. Go to the query menu -> Connection -> Change Connection (Alt+Q, C, H)

The change connection menu button actually does have a shortcut key predefined (Alt+H); however this action has a lower priority than the (Alt+H) shortcut for the Help Menu. Thanks Microsoft! I'll show you how to enable this the Change Connection action using (Alt+G).

The work around is actually quite simple, but it is not very intuitive.
  • Right click anywhere on the toolbar and select Customize
  • Ignore (but don't close this yet) the Customize window that pops up
  • Right Click on the Change Connection toolbar button and select "Image & Text"
    • This enables the hotkey to be use inside the query window but you can not activate it yet because Help Menu shortcut (Alt + H) still has precedence.
  • Right Click on the Change Connection toolbar button again
  • Change the Name field from "C&hange Connection..." to "Chan&ge Connection..."
  • Close the Customize window that popped up earlier.
Now you can use the Alt + G keyboard shortcut to change connections.

No comments:

Post a Comment