SSIS – OnPreExecute and OnPostExecute Fire Multiple Times

If you are trying to use an event handler like OnPreExecute or OnPostExecute in SSIS to log execution information you will notice that each event is being fired multiple times even if you configure the event at package level but you need these events to fire only once!

One quick way to fix this is to add an empty script task at the beginning of the event handler and on the precedence constraint coming out of that task to set:

  • Evaluation Operation = Expression
  • Expression = @[System::SourceName] ==  @[System::PackageName]

Image

Advertisements

6 thoughts on “SSIS – OnPreExecute and OnPostExecute Fire Multiple Times

  1. Very good! You can also simplify it a bit more by just adding an expression to “Disabled” property of Log Execustion Complete task (but negating it) “@[System::PackageName] != @[System::SourceName]” Then you don’t need the empty script task

      • The “disabled” property gets evaluated each time, so it is “enabled” when expression is not true anymore (“@[System::PackageName] != @[System::SourceName]”)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s