Paynetech
Paynetech

Reputation: 127

How do I simply clear a table before importing data?

Why is it so difficult to figure out how to clear out data from a table before an import? Could someone please point me in the right direction for a standard, best practice procedure for doing so within SSIS 2012? I've used basic SQL statements; i.e. Delete Tablename, TRUNCATE tablename, etc...

Upvotes: 4

Views: 9346

Answers (3)

The Cog
The Cog

Reputation: 173

@Paynetech - Sorry this question was down-voted as this seemingly simple task was throwing me off when trying to create an SSIS project myself. And since I have to post this as an answer as I can't comment to your original question, here is some additional information to read that helped me: http://social.msdn.microsoft.com/forums/sqlserver/en-US/d69f2598-3f95-41f1-bd86-da46e9b6d18b/want-to-delete-records-from-table-using-ssis

By the way, when searching google for "ssis how to delete" - this question is #2, #1 being how to delete an SSIS package itself.

Upvotes: 0

jymbo
jymbo

Reputation: 1375

I would use an Execute SQL Task to do this. Put your truncate or delete from statement in the SQLStatement property. Also, as Lamark stated, you may want to ensure that the task's "Result Set" property is set to none since you are having trouble with errors being returned due to the result bindings.

Upvotes: 6

Mike Henderson
Mike Henderson

Reputation: 1317

Related to best practice, I usually follow the practice of doing as much at the SQL level as you can. The Execute SQL Task as @jymbo advises would likely be the best course of action even it there was a means to truncate within SSIS itself.

Upvotes: 0

Related Questions