3.2. Execute SQL Task

The Execute SQL task will execute one or a series of SQL statements or stored procedures. The task has been greatly improved in SSIS and now allows you to execute scripts that are in a file. Most of the configuration this time is in the General page (shown in Figure 3-1). The Timeout option specifies the number of seconds before the task will time-out. A value of 0 means it can run for an infinite amount of time.

The ResultSet option sets what format you'd like the results of the query to be outputted in. By default, the results of the query will be ignored by setting the option to none. This is great when you want the SQL statement to prepare a staging table. You can also output the results to a single row, full result set, or XML format. Once you set this option to something other than none, you'll be able to map where you want the results to go in the Result Set page. This page maps the result set to a user parameter and lets you create a new one. The variable you output the results to can be in the scope of a single container or the entire package. You can then later use those results somewhere else in your package. An example of this may be to check a value in a table that was set by another package. If the value is set to 1, that package has completed and you can proceed to the next task. Otherwise, you may loop back to the beginning of the package and try again.

The ConnectionType option, as its name implies, specifies what type of connection you'd ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.