title | description | author | ms.author | ms.date | ms.service | ms.subservice | ms.topic | helpviewer_keywords | dev_langs | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Extending the Package with the Script Task |
Extending the Package with the Script Task |
chugugrace |
chugu |
03/14/2017 |
sql |
integration-services |
reference |
|
|
[!INCLUDEsqlserver-ssis]
The Script task extends the run-time capabilities of [!INCLUDEmsCoName] [!INCLUDEssISnoversion] packages with custom code written in [!INCLUDEmsCoName] Visual Basic or [!INCLUDEmsCoName] Visual C# that is compiled and executed at package run time. The Script task simplifies the development of a custom run-time task when the tasks included with [!INCLUDEssISnoversion] do not fully satisfy your requirements. The Script task writes all the required infrastructure code for you, letting you focus exclusively on the code that is required for your custom processing.
A Script task interacts with the containing package through the global Dts object, an instance of the xref:Microsoft.SqlServer.Dts.Tasks.ScriptTask.ScriptObjectModel class that is exposed in the scripting environment. You can write code in a Script task that modifies the values stored in [!INCLUDEssISnoversion] variables; later, the package can use those updated values to determine the path of its workflow. The Script task can also use the [!INCLUDEvisual-basic] namespace and the [!INCLUDEdnprdnshort] class library, as well as custom assemblies, to implement custom functionality.
The Script task and the infrastructure code that it generates for you simplify significantly the process of developing a custom task. However, to understand how the Script task works, you may find it useful to read the section Developing a Custom Task to understand the steps that are involved in developing a custom task.
If you are creating a task that you plan to reuse in multiple packages, you should consider developing a custom task instead of using the Script task. For more information, see Comparing Scripting Solutions and Custom Objects.
The following topics provide more information about the Script task.
Configuring the Script Task in the Script Task Editor
Explains how the properties that you configure in the Script Task Editor affect the capabilities and the performance of the code in the Script task.
Coding and Debugging the Script Task
Explains how to use [!INCLUDEmsCoName] [!INCLUDEvsprvs] Tools for Applications (VSTA) to develop the scripts that are contained in the Script task.
Using Variables in the Script Task
Explains how to use variables through the xref:Microsoft.SqlServer.Dts.Tasks.ScriptTask.ScriptObjectModel.Variables%2A property.
Connecting to Data Sources in the Script Task
Explains how to use connections through the xref:Microsoft.SqlServer.Dts.Tasks.ScriptTask.ScriptObjectModel.Connections%2A property.
Raising Events in the Script Task
Explains how to raise events through the xref:Microsoft.SqlServer.Dts.Tasks.ScriptTask.ScriptObjectModel.Events%2A property.
Logging in the Script Task
Explains how to log information through the xref:Microsoft.SqlServer.Dts.Tasks.ScriptTask.ScriptObjectModel.Log%2A method.
Returning Results from the Script Task
Explains how to return results through the property xref:Microsoft.SqlServer.Dts.Tasks.ScriptTask.ScriptObjectModel.TaskResult%2A and the xref:Microsoft.SqlServer.Dts.Tasks.ScriptTask.ScriptObjectModel.ExecutionValue%2A property.
Script Task Examples
Provides simple examples that demonstrate several possible uses for a Script task.
Script Task
Comparing the Script Task and the Script Component