February 24, 2015 at 1:02 pm
Does anyone know of an easy way to get notifications from specific steps in a SQL job?
I have a nightly job that fills reporting tables, and I have it broken out into about 20 steps. Since they are all independent, I have it set so that if one fails it simply goes on to the next step - but I'd still like to know about the failure. Is there any way to have each individual step send a notification if it fails?
February 24, 2015 at 1:17 pm
cphite (2/24/2015)
Does anyone know of an easy way to get notifications from specific steps in a SQL job?I have a nightly job that fills reporting tables, and I have it broken out into about 20 steps. Since they are all independent, I have it set so that if one fails it simply goes on to the next step - but I'd still like to know about the failure. Is there any way to have each individual step send a notification if it fails?
You could put the SQL for each step in a try/catch block and then use the catch block to send a notification email using sp_send_dbmail. You would have to have database mail configured.
February 24, 2015 at 2:25 pm
Or use Michael's TRY-CATCH technique but write a row to a log file instead of sending an email. I know some DBAs frown on using the email function.
Sigerson
"No pressure, no diamonds." - Thomas Carlyle
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply