SQLCMD Mode - Run your queries against several servers in a single query window. | SansSQL

Thursday, July 8, 2010

SQLCMD Mode - Run your queries against several servers in a single query window.

To run your queries on different servers using the same query editor, you have to 
  1.  First connect to a server
  2. Open a new query
  3. And now click on “Query” menu.
  4. Choose “SQL CMD Mode”

Once you click on “SQL CMD Mode”, the query editor will go into command line mode.
Now type :Connect ServerName. This command will establish a connection to the server you have specified and then it will execute your query on that server.

Results:
Now if you go to “Messages” Tab, you will see the below result text (self explanatory).

No comments:

Post a Comment