An Execute SQL task lets you build and add executable SQL statements as package components.
The SQL specified in an Execute SQL task is passed through to the OLE DB provider specified in the associated connection object. The syntax of the SQL statement must be valid for the specified OLE DB provider. Multiple SQL statements can be specified. The Execute SQL task also supports the GO command from Query Analyzer, osql, and isql. All the SQL statements from one GO to the next are sent in one string, or batch, to the OLE DB provider for execution. GO must be by itself on a line and start in the first position of the line, anything on the line after the GO command is ignored. GO is the only syntax for which the Execute SQL task scans, all other statements are passed through to the OLE DB provider. For more information on using batches with SQL Server, see Batches.
The Execute SQL icon is located in the Task section of the tool palette. Add an Execute SQL task by dragging the icon to the location you want on the DTS Designer workspace.
Note Before configuring an Execute SQL task, you must have defined at least one data source connection on the workspace.
When defining an Execute SQL task, you can use DTS Query Designer to build your query. This tool allows you to create SQL commands using a visual interface. You can create complex, multitable queries by dragging tables into your query, selecting options, and entering values.