Extending the Package with the Script Task
Applies To: SQL Server 2016 Preview
The Script task extends the run-time capabilities of Microsoft Integration Services packages with custom code written in Microsoft Visual Basic or Microsoft 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 Integration Services 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 ScriptObjectModel class that is exposed in the scripting environment. You can write code in a Script task that modifies the values stored in Integration Services variables; later, the package can use those updated values to determine the path of its workflow. The Script task can also use the Visual Basic namespace and the .NET Framework 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 Microsoft Visual Studio 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 Variables property.
- Connecting to Data Sources in the Script Task
Explains how to use connections through the Connections property.
- Raising Events in the Script Task
Explains how to raise events through the Events property.
- Logging in the Script Task
Explains how to log information through the Log method.
- Returning Results from the Script Task
- Script Task Examples
Provides simple examples that demonstrate several possible uses for a Script task.