Skip to content

Running SQL Queries On Multiple Servers At Once Using Registered Servers In SQL Server Management Studio

I just came across a situation where I was looking at long running queries across a few production servers, I wanted to quickly and easily run my query across them all to make sure that I wasn’t missing a problem on each server where a user had left a specific query for a looong time.

Thankfully, registered servers is here to the rescue! Many people using SSMS have never even used registered servers, and if they have, they dont know about this secret context menu hiding in the GUI.

What’s a registered server?

A registered server is effectively a way to remember that you have connected to a server, and allow easy access to connecting to it again. (There is probably a MUCH more technical explanation, but this one suffices. (Want more? Check the “BOL”:page)

In SSMS you can simply right click any active server and select “Register” to bring up the prompt to register the server. If you are running more than one set of servers that should be running different queries, then you may want to create additional server groups (when we get there).

In SSMS 2008, you can simply use the shortcut CTRL+ALT+G or select “Registered Servers” under the View menu.

Once that is complete, you should be able to right click any group you have created, and select “New Query”.

When you run your query, you should notice that an additional column exists now, with the label of the server that returns the query results.

Enjoy!

Learn More

Published inUncategorized

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *