0

In my company's SQL Server (2005), there's a job that has about 20 steps. Each step is set to go to the next step on error. What's the best method for getting a notification sent out if a step has an error?

Erik
  • 161
  • 2
  • 12

1 Answers1

1

The way I have done this is in between each step, have a step that sends a notification. So step 1 says on failure, move to "Step 2: notify that step 1 failed" and on success, move to step 3. Step 3 says on failure, move to "Step 4: notify that step 3 failed" and on success, move to step 5. Etc. Feels kind of dirty but since we were using simple database mail for alerts (rather than agent operators etc) it was very easy to code those intermediate steps. You can even use tokens so that all the steps simply call a stored procedure and the parameters can be filled in automatically.

Aaron Bertrand
  • 272,866
  • 37
  • 466
  • 490