Add an Event Handler to a Package
Applies To: SQL Server 2016
At run time, containers and tasks raise events. You can create custom event handlers that respond to these events by running a workflow when the event is raised. For example, you can create an event handler that sends an e-mail message when a task fails.
An event handler is similar to a package. Like a package, an event handler can provide scope for variables, and includes a control flow and optional data flows. You can build event handlers for packages, the Foreach Loop container, the For Loop container, the Sequence container, and all tasks.
You create event handlers by using the design surface of the Event Handlers tab in SSIS Designer.
When the Event Handlers tab is active, the Control Flow Items and Maintenance Plan Tasks nodes of the Toolbox in SSIS Designer contain the task and containers for building the control flow in the event handler. The Data Flow Sources, Transformations, and Data Flow Destinations nodes contain the data sources, transformations, and destinations for building the data flows in the event handler. For more information, see Control Flow and Data Flow.
The Event Handlers tab also includes the Connections Managers area where you can create and modify the connection managers that event handlers use to connect to servers and data sources. For more information, see Create Connection Managers.
In SQL Server Data Tools (SSDT), open the Integration Services project that contains the package you want.
In Solution Explorer, double-click the package to open it.
Click the Event Handlers tab.
In the Executable list, select the executable for which you want to create an event handler.
In the Event handler list, select the event handler you want to build.
Click the link on the design surface of the Event Handler tab.
Add control flow items to the event handler, and connect items using a precedence constraint by dragging the constraint from one control flow item to another. For more information, see Control Flow.
Optionally, add a Data Flow task, and on the design surface of the Data Flow tab, create a data flow for the event handler. For more information, see Data Flow.
On the File menu, click Save Selected Items to save the package.