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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run Stored Procedure from one DB on Another

Status
Not open for further replies.

jabrony76

Technical User
Apr 23, 2001
125
US
Hello,

Currently we have one database for each of our clients (not my choice, came into this system) and have some standard scripts that are run when new data is loaded to the system.

As it is now, I have all this wrapped into a SP and each DB has a copy of this SP. Needless to say, maintenance is a pain. Also, we are starting to do DB-specific things for some clients and always making changes to the script.

I would like for each DB to have a individualized SP that does any specific stuff and then calls the standard SP in a centralized location.

I know 'Use Database' command doesn't work in SP and I could concatenate all the code into a variable and use SP_EXECUTESQL to run this. Can't\don't want to go this way because the Code is 3000+ lines.

Any ideas on how to call a centralized SP to run on a specified DB?

Thanks
 
You might be better off putting it into a script file and using osql to execute it in the database.

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top