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

RUNNING SP FROM WITHIN SP

Status
Not open for further replies.

kissarmi

Programmer
Feb 14, 2002
72
US
Hi,

I need to run a stored procedure, (with parameters), from within another stored procedure.
Some of the SP's I need to run are in another database, and should execute for the database that they are located in.
How do I call a SP from within a SP, and is the naming convention for running SP's in another database the same as updating a table: database.owner.table?

Thanks for any help.
 
Simply:

EXEC mydb.owner.mysp parameter_1, parameter_2, ...

or
EXEC mydb.owner.mysp @par_name1 = parameter_1, @par_name2 = parameter_2, ...

where '@par_name1' and '@par_name1' are names of parameters in the SP 'mydb.owner.mysp'


Zhavic

---------------------------------------------------------------
In the 1960s you needed the power of two Comodore64s to get a rocket to the moon. Now you need a machine which is a vast number of times more powerful just to run the most popular GUI.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top