5 pts.
 SQL Stored Procedure
Is there a way to call a child stored procedure form a parent sp but then immediately stop the parent?

Software/Hardware used:
ASKED: April 7, 2009  3:29 PM
UPDATED: April 8, 2009  8:40 PM

Answer Wiki:
Stored procedures have return values. In the parent sp check for a successful return value and end it in an if statement. You can use a technique like this to do this. <pre> CREATE PROCEDURE YourParentPRoc AS DECLARE @retValue INT EXEC @retValue = YourChildProc IF @retValue <> 0 return(0) /* More code goes after the return. */ END</pre> This will run the child procedure and if the return value is not 0 it will stop the parent. Any code after the return does not get run if the @retValue <> 0 is true.
Last Wiki Answer Submitted:  April 8, 2009  8:40 pm  by  mshen   27,310 pts.
All Answer Wiki Contributors:  mshen   27,310 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

You might want to explain further what you need to accomplish.

 63,535 pts.