how my outer sp know if inner sp gives error sql [Resolved]

Posted by Harsh_rc under Sql Server on 12/9/2011 | Points: 10 | Views : 963 | Status : [Member] | Replies : 4
can anyone tell me,how my outer sp know if inner sp gives error in sql

and in this case where can i commit transaction if inner sp failed.




Responses

Posted by: Harsh_rc on: 12/14/2011 [Member] Starter | Points: 25

Up
0
Down

Resolved
thanks

Harsh_rc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nilschaudhari on: 12/13/2011 [Member] Starter | Points: 25

Up
0
Down
hi,

Use the RISEERROR for getting the error from the inner sp

Harsh_rc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sksamantaray on: 12/13/2011 [Member] Silver | Points: 25

Up
0
Down
Hi ,
1.Create an error log table.
2.User transactions in your procedure
in the catch section write your error statements to the error log table you created refer to point#1

Thanks,
Sanjay

Harsh_rc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hmanjarawala on: 12/13/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi,

you can do one more thing.....pass out parameter called error string of type varchar(max) or say numeric parameter say errorcode.

in inner sp check if @@Errorcode <> o then put that errorcode to our parameter called errorcode or alternativly pass any custom message to our parameter error string.
handle these parameters in outer sp

Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere
http://fieredotnet.wordpress.com/

Harsh_rc, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response