February 23, 2012 at 3:39 am
Hey all,
I have a stored procedure that calls many other stored procs - some of which in turn call other stored procs.
I have built a try catch error handle that if an error occurs it logs the issue (rather then just dying like it used to).
All is running well.
Now however i want to put in a new proc - that will probably be called by lots of the stored procedures in this main proc (hope your following my thoughts here!).
BUT...... here is my question.
If this stored proc errors i do not want the main package to error. If i use the try catch in this sub\sub procedure - does that mean that the main error handle wont fire? and the main proc will just continue on its course.
If so thats exactly what i want to do. If someone can give me an idea of how this works it would be great - i have tried to find details on how levels of error handling work, but i cant seem to find much. Probably wrong search terms.
Thanks in advance.
Dan
February 23, 2012 at 4:14 am
Do not re-raise the error in your CATCH block, then calling stored proc will have no idea about any error happened in the called proc.
February 23, 2012 at 4:16 am
Thats great. Thank you!
I presume i would be equally ok by raising the error but with a severity under 10?
Dan
February 23, 2012 at 4:51 am
Yes, you are right.
Raising error with severity less than 10 is the mechanism to return messages back to the caller. If called from within TRY block they will not transfer control to CATCH one.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply