Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Execution of Code on Multiple Servers Remotely

By Rudy Panigas,

Do you have more than 10 sql servers you must manage?
Most DBA s do, I have over 120 sql instances to manage. Before I used to use ISQL/OSQL in a batch to execute a command on all these instances. It works but not very nice. Below is the code I use to collect information of all my servers from T-SQL. No more batch files for me!

Basically, this code will create a table that houses your instance names and 'sa' passwords, create linked connection, execute your code, drop the link connection and finally delete the temp table. To add more instances, just  add another line to the "insert into" section of the code. My first usage of this code is to connect to all my production servers and report back the job  status on a daily basis. I only see the failed jobs and start my day from there.

You must execute this from a SQL 2005 connection as the linked server code is slightly different on SQL 2000 than SQL 2005. But that's ok as I connect to SQL 7.0, SQL 2000 and SQL 2005 servers.

Read the comments at the beginning of the code which shows you how to modify it for your enironment.

I hope that this code will make you life easier as it has done for me.

Total article views: 693 | Views in the last 30 days: 5
 
Related Articles
FORUM

Connecting to different instance of SQL Server

Connecting to different instance of SQL Server

FORUM

Can't connect to SQL Server 2005 instance

Can't connect to SQL Server 2005 instance

FORUM

connect to a sql server 7 instance

how do i connect to a sql server 7 instance

FORUM

named instance connection problem

named instance connection problem

FORUM

connecting to a sql server 2000 named instance

connecting to a sql server 2000 named instance

Tags
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones