Aiden
Aiden

Reputation: 139

How to avoid the same Event Handler hit multiple times

I am trying to put the sending email task in the event handler in "OnError" situation. But I found sometimes it will send multiple emails while the same task fails. Is that possible we can only send one email which means only trigger the event handler one time. In the screenshot, you can see in the same task, it get 4 errors so it hit the same event handler 4 times. Can we reduce it to 1? Thanks !!

enter image description here

Upvotes: 0

Views: 566

Answers (1)

Mark Wojciechowicz
Mark Wojciechowicz

Reputation: 4477

Ideally, don't put email functionality in your ssis package. Emails can be issued from the calling task scheduler like SQL agent or whatever enterprise one you might be using.

If you really have a good reason to send an email, you can use the following pattern, use a sequence container to wrap up all your tasks, add a failure constraint to the end going to an email:

enter image description here

As an alternative, you can post to slack or teams: https://www.thisintelligentlife.net/posting-to-slack-from-sql-agent

Upvotes: 1

Related Questions