May 5, 2009 at 10:36 pm
Hi Everybody,
Can any one help me in finding whether a stored procedure run successfully or not. I am using sql server 2000. I am calling a sp in another sp. Basing on the status of the innner sp i need to do some operations.
Thanks in advance.
Who is wise? He that learns from everyone. Who is powerful? He that governs his passions. Who is rich? He that is content. Who is that? Nobody.:)
May 6, 2009 at 6:11 am
Hi
It depends on how your inner procedure returns that something was not successfully. Your inner procedure can return a return code which can be handled in your outer procedure.
Greets
Flo
May 6, 2009 at 8:14 am
Here is a simple example:
DECLARE @retval INT
EXEC @retval = sys.sp_who
IF @retval = 0 -- success
BEGIN
PRINT 'Success'
END
ELSE
BEGIN
PRINT 'Failure'
END
By default stored procedures return 0 for success, but you can specify any integer for the return value based on whay happend in your stored procedure.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply