July 7, 2014 at 8:45 am
Hello everyone - quick question on how to handle an error.
Within my Stored Procedure I have a normal TRY CATCH block that handles errors and it works fine.
The issue I have is that it will not work when the job fails due to an authentication failure; for example, we have a Linked server and something happened - we lost access and my job failed.
However, the try catch did not capture that since the procedure never really ran.
Is there a way to catch something like that?
Thank you.
AV
July 7, 2014 at 10:25 am
I believe you can catch that error by wrapping the SP call within a TRY CATCH.
If you are dealing with a linked server you can also use sys.sp_testlinkedserver to check for connectivity and then execute the SP. Of course, connectivity issues could happen between the test execution and the actual code execution.
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
July 7, 2014 at 10:49 am
It is simple and makes sense - I should've though of that 🙂
Thank you.
Adrian
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply