The OnError event,
which is raised when an error occurs, is the default event in SSIS. In addition to the
package, various components such as for loop, task host containers, etc. can raise
events. Events can be raised by other executables such as for loop, and task host
containers. You can create a custom event handler that traps these errors for some
useful purpose. For example, you could send an email when a task fails. Besides
OnError, there are many other types of events raised by the executables as shown in
the following figure where the executable package is called ExecTSQLTask2
(file name of package, ExecTSQLTask2.dtsx).
Chapter 1
[ 25 ]
Containers in a package follow a hierarchy. If the event in a container is not handled,
it can escalate the handling of the event to a container higher up in the hierarchy,
quite like events on a web page which also have a container hierarchy. If there are no
event handlers configured at any of the containers, the event never gets handled.
Like other objects in SSIS, event handlers need a name and a description. You may
need to indicate whether or not the event handler runs and also indicate whether the
package fails if the event handler fails; you may also indicate an execution result to
return instead of the actual execution result for the event handler at run time. Also,
an event handler can have a transaction option as well as a logging mode specified.
You will see an example with two event handlers in a package in Chapter 16.
Pages:
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44