Change Connection on Same Query

Ever so often you have one of those moments where you know that you should have known something and been using it daily, because it would have shaved seconds off of your time to perform a certain task. I believe this one even constitutes creating a new category just for this sort of thing.

Change Connections in SSMS

I found myself playing with a Solution someone had put together in SSMS that had Connections and Queries but I needed to change the connection. That lead me to this wonderful technet article that should have already been something I’ve used. This means that this whole time that I’ve had a query open in a window, I could have just right-clicked and hit the Connection –> Change Connection option.

I did find one negative aspect to this pretty quickly because the new connection will not show up in your object explorer window and I’m used to looking at that so that I know where I have been touching things. If you are careful you could end up forgetting which server you are connected to when you run that query.

 

  • http://blog.merazzi.eti.br Logan Destefani Merazzi

    Jason,

    If you look to the Status bar (usually, at bottom right of SSMS), it shows the server and the connection you’re using.
    If it doesn’t, go to Tools -> Options -> Text Editor -> Editor Bar and Status Bar and configure it to display those information.
    Hope this helps to not get lost. ;-)

    Best Regards.

    Logan

  • Jason

    @Logan
    I have learned to look at that bar very often when working with a server. I’m pretty fond of Brent Ozar’s article (http://www.brentozar.com/archive/2011/06/fixing-sql-server-management-studios-tab-text/) and changing all that stuff around and putting it at the top helps me personally.
    Thanks for taking the time to comment.