Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running the same SP on multiple DBs on different servers 2

Status
Not open for further replies.

TiltingCode

Programmer
Apr 10, 2009
61
US
Is it possible to run a stored procedure from one database and have it execute on other databases and servers?

What I have is a SP which deletes records after a certain time. We have SIT, UAT and production environments on different servers. If this is possible can you please share what I need to do?

thanks much
 
You have different environments for a reason, don't cross those lines.

Cross Database and Cross Server are different problems.

The easiest way to do this is have the stored procedure applied on all necessary databases and then set up a job to run the sproc at a given interval.

You "could" set the sproc up so that it read the server / db name from a table, then generated a dynamic sql statement to run, though this could be painful later. You may also have auditing problems later.

Lodlaiden.

You've got questions and source code. We want both!
 
Thanks for the replies. I'll look up PowerShell but for now looks like I'll be creating multiple SPs.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top