Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Your site was well structured and I found what I was looking for in about 2 minutes. I am looking forward to participating with you in the future..."

Geography

Where in the world do Tek-Tips members come from?

Running the same SP on multiple DBs on different serversHelpful Member!(2) 

TiltingCode (Programmer)
19 Apr 12 17:13
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
Helpful Member!  Qik3Coder (Programmer)
19 Apr 12 18:42
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!

Helpful Member!  markros (Programmer)
19 Apr 12 18:52
If every DB will have this SP, you can run a PowerShell script to run the stored procedure in multiple servers / multiple DBs.

PluralSight Learning Library

TiltingCode (Programmer)
20 Apr 12 4:24
Thanks for the replies.  I'll look up PowerShell but for now looks like I'll be creating multiple SPs.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close