Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
dcummiskey
Starting Member
26 Posts |
Posted - 2004-07-28 : 16:38:46
|
Hello -IF i have a stored procedure that executes several other procedures..do they execute in the order listed?For instance in my proc i have:exec storeproc1exec storedproc2exec storedproc3Will it complete processing storedproc1 before it moves onto storeproc2?Also, is there a check in place to verify it executed? should I return a value from storedproc1 ... check that value and if its true then execute storedproc2..guess I'm looking for an example on how to execute multiple stored procedures from a stored procedure. thanks,Dan |
|
|
Pat Phelan
Posting Yak Master
187 Posts |
Posted - 2004-07-28 : 17:27:24
|
Yes, stored procedures make this pretty easy, although very few folks make use of those features any more. As a short example:CREATE PROCEDURE pA ASBEGIN RETURN 0ENDGOCREATE PROCEDURE pB ASBEGIN RETURN 0ENDGOCREATE PROCEDURE pC ASBEGIN RETURN 0ENDGOCREATE PROCEDURE pMaster ASBEGINDECLARE @iRC INTEXECUTE @iRC = pAIF 0 = @iRC EXECUTE @iRC = pBIF 0 = @iRC EXECUTE @iRC = pCRETURN @iRC If any of the procedures returns a non-zero value, the rest will not be called. Short, simple, and to the point!-PatP |
 |
|
|
dcummiskey
Starting Member
26 Posts |
Posted - 2004-07-29 : 10:24:08
|
| sweet! thanks. |
 |
|
|
|
|
|