SSIS: Execute SQL Task

Integrating Custom SQL Into the Package.

First, drag a Execute SQL Task unto the designer.


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.”


Leave a Reply

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

You are commenting using your 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 )

Connecting to %s