SSIS: Execute SQL Task

Integrating Custom SQL Into the Package.

First, drag a Execute SQL Task unto the designer.

1-execute-sql-task

Next, I’ll fill the “HumanResources.NewHires” table with records.
In my resultset, the PK values ranges from “105” to “114.”

Double-click the task, then SQL statement property’s ellipses to enter the SQL statement.

In this example, I’ve chosen to empty the “NewHires” table and resetting the PK value back to 100, regardless of any preexisting records.
Then, I’ll execute the package which will empty the table and reset the PK identity value.
When I query the table, I see no records exists.

Now when I populate that table with test records, the first record’s PK begins at “100” due to my SQL Task’s script usage which resets the PK value back to “100.”

3-execute-sql-task

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s