Export (0) Print
Expand All

Handling DTS Events and Errors

SQL Server 2000

Handling DTS Events and Errors

The Package2 object raises events that report package status during execution. The Package2 Execute method can raise errors that must be handled by the calling application.

Package Events

The following table specifies the events the Package2 object raises and the information that is returned when the specified condition occurs.

Event Condition Information returned
OnError A Data Transformation Services (DTS) error occurred during package execution. Step name, error code and description, help file and context, interface ID.
OnFinish A step has completed. Step name.
OnProgress This event occurs periodically during step execution. Step name, progress count (typically rowcount), percent complete, description.
OnQueryCancel This event gives application a chance to cancel a step. Step name.
OnStart A step has started. Step name.

For more information about these individual events, see Events.

If you implement handlers for any of the events, you must supply handlers for all the events. Unneeded event handlers can consist of a single statement (for example, Exit Sub or return;).

For more information about implementing event handlers in DTS programs, see DTS Package Events in Visual Basic.

Package Error Handler

During the phase of your program where you are creating DTS objects and setting their properties, you can implement error handling that is typical for your programming environment.

Errors that occur during the Execute method of the Package2 object are not propagated back to the caller unless you set the Package2 object FailOnError property or the Step2 object FailPackageOnError property to TRUE. FailPackageOnError causes an error in the referenced step to fail the package, while FailOnError causes an error in any step to fail the package.

You must retrieve errors that occur within individual steps with the GetExecutionErrorInfo method of the Step2 object. GetExecutionErrorInfo provides information only about errors that cause a step to fail. For more detailed information, you must implement handlers for the OnError and OnProgress events. You must provide at least stub handlers for the other events. The OnError event will describe the error, while the OnProgress event will indicate the step and the row being processed. The ProgressRowCount property of the DataPumpTask2, DataDrivenQueryTask2, and TransformationSet objects can be used to specify how frequently OnProgress is raised.

For more information about implementing package error handlers in DTS programs, see DTS Error Handlers in Visual Basic.

Show:
© 2014 Microsoft