title | description | author | ms.author | ms.date | ms.service | ms.subservice | ms.topic | helpviewer_keywords | |
---|---|---|---|---|---|---|---|---|---|
Raising Events in the Script Component |
Raising Events in the Script Component |
chugugrace |
chugu |
03/04/2017 |
sql |
integration-services |
reference |
|
[!INCLUDEsqlserver-ssis]
Events provide a way to report errors, warnings, and other information, such as task progress or status, to the containing package. The package provides event handlers for managing event notifications. The Script component can raise events by calling methods on the xref:Microsoft.SqlServer.Dts.Pipeline.ScriptComponent.ComponentMetaData%2A property of the ScriptMain class. For more information about how [!INCLUDEssISnoversion] packages handle events, see Integration Services (SSIS) Event Handlers.
Events can be logged to any log provider that is enabled in the package. Log providers store information about events in a data store. The Script component can also use the xref:Microsoft.SqlServer.Dts.Pipeline.ScriptComponent.Log%2A method to log information to a log provider without raising an event. For more information about how to use the xref:Microsoft.SqlServer.Dts.Pipeline.ScriptComponent.Log%2A method, see the following section.
To raise an event, the Script task calls one of the following methods of the xref:Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSComponentMetaData100 interface exposed by the xref:Microsoft.SqlServer.Dts.Pipeline.ScriptComponent.ComponentMetaData%2A property:
Event | Description |
---|---|
xref:Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSComponentMetaData100.FireCustomEvent%2A | Raises a user-defined custom event in the package. |
xref:Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSComponentMetaData100.FireError%2A | Informs the package of an error condition. |
xref:Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSComponentMetaData100.FireInformation%2A | Provides information to the user. |
xref:Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSComponentMetaData100.FireProgress%2A | Informs the package of the progress of the component. |
xref:Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSComponentMetaData100.FireWarning%2A | Informs the package that the component is in a state that warrants user notification, but is not an error condition. |
Here is a simple example of raising an Error event:
Dim myMetadata as IDTSComponentMetaData100
myMetaData = Me.ComponentMetaData
myMetaData.FireError(...)
Integration Services (SSIS) Event Handlers
Add an Event Handler to a Package