Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSIS Package level OnError sends two emails

I have a package that sends out two emails whenever a control flow element fails. For example, if the ExecuteSQL Task fails, the Package level OnError event handler fires two emails.

Is this a known issue? How do I get around this? I can do this through database driven scripts, but essentially, I would like to handle the situation on SSIS itself. Thanks for any help.

like image 937
rvphx Avatar asked Oct 08 '22 05:10

rvphx


1 Answers

Keep in mind that event handlers will raise events anytime the triggering action occurs. So, you're not guaranteed to only get one event using an event handler (with a few exceptions of course).

If you want to guarantee only one email then I would recommend not sending email via the OnError event and instead linking a 'Send Email Task' that is part of the control flow and connected to the ExecuteSQL task with a 'Failure Constraint'.

Or, you could also set a user variable equal to true in the OnError event and then send the email based on that with a 'On Completion' constraint mixed with an expression that checks the value of the Error user variable. That way, it doesn't matter how many times the OnError event raises as the task will only run if it was raised at least once.

like image 57
RThomas Avatar answered Oct 13 '22 01:10

RThomas