Extending the Package with the Script Task

The Script task extends the run-time capabilities of Microsoft SQL Server 2005 Integration Services (SSIS) packages with custom code written in Microsoft Visual Basic .NET 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 SQL Server 2005 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 .NET 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.

Topic Description

Configuring the Script Task in the Script Task Editor

Properties that you configure in the Script Task Editor affect the capabilities and the performance of Script task code.

Coding and Debugging the Script Task

The Visual Studio for Applications (VSA) development environment is used to develop the scripts 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

Explains how to return results through the property TaskResult and the ExecutionValue property.

Script Task Examples

These simple examples demonstrate several possible uses for a Script task.

Community Additions