7.3. Script Tasks

The role of the Script task is primarily to control the flow of the SSIS package. When one of the existing Control Flow Items is not flexible enough to perform the action you desire, you should consider writing a script.

Here you'll create your very first SSIS script. You will create the most basic "Hello World!" example just to see how to add a script to a package, edit it, and execute it.

To create a SSIS project and add a Script task, do the following:

  1. Create a new Integration Services Project.

  2. Ensure that the Control Flow tab is selected and open the Toolbox.

  3. Select the Script task from the Toolbox and drag it to the Control Flow container.

Your screen should look something like Figure 7-7.

Figure 7.7. Figure 7-7

To open the Script task, you can double-click it or right-click it and select Edit. This will bring up the Script Task Editor window, as shown in Figure 7-8.

Figure 7.8. Figure 7-8

This window allows you to set a name for your script and give it a description. Never leave the name set to the default value; always give your script a meaningful name and description. Go ahead and change the Name property from Script Task to HelloWorldScriptTask. Change the description to "Prints ‘Hello World!’ to the screen."

Now select Script in the left pane. This ...

Get Professional SQL Server™ 2005 Integration Services now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.