Chapter 38. Using Event Handlers
While the main tasks of SSIS packages exist in either the Control Flow or the Data Flow, the Event Handlers tab, the subject of this lesson, is another tab that is very useful when you are creating a package. Event handlers are what enable you to call tasks when events like errors or warnings occur during the execution of a package, which can be helpful in logging errors or sending notifications. The Event Handlers tab is used to call a task when an event has occurred in the package. The tasks in the event handler run only if the proper event is called in the package. Therefore, it is possible to have tasks in the event handlers of a package that don't run during the execution of the package because the proper event is not called.
Several events can occur in a package to cause an event to fire and call an event handler:
OnError
OnExecStatusChanged
OnInformation
OnPostExecute
OnPostValidate
OnPreExecute
OnPreValidate
OnProgress
OnQueryCancel
OnTaskFailed
OnVariableValueChanged
OnWarning
The most commonly used events are OnError, OnWarning, OnPreExecute, and OnPostExecute. The OnError event fires when the executable selected has an error occur during its execution. The OnWarning event fires when the executable selected has a warning occur during its execution. The OnPreExecute event fires just before the selected executable starts executing. The OnPostExecute event fires just after the selected executable finishes executing.
Creating Event Handlers
When you open the ...
Get Knight's 24-Hour Trainer: Microsoft® SQL Server® 2008 Integration Services now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.