I have a script that has a try catch in it so that if it fails I can roll back the transaction. It runs on a job scheduled through SQL Server Agent. But when it fails SQL Server Agent does not see that it failed, I'm assuming because I catch the error. I want it to still retry the job even if I catch the error. I put in the RAISEERROR command in my catch part of the script to try and throw the error up to SQL Server Agent but it did not work. Any solutions?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
Did you use RAISERROR with severity 16?
Did you set the job step to retry (
Finally, is the error terminating (severity 20) such that the CATCH block isn't hit?