Clearing tables before updating them with an ssis package

  • I have successfully setup an SSIS package to update another sql server however it appears it is appending the data as opposed to wiping everything and copying over. I suspect this because I get a duplicate primary key error in one of the tables. Is there a way of the clearing the tables I am about to copy before send the ssis package?

  • "truncate table" as the first step in the package.

  • If you have any foreign keys you cannot use truncate nor can you delete any rows that have "child" rows. For example if I have orders and order_details with a foreign key on order_id then I cannot delete any rows in orders that have rows in order_details so in my ssis package I would need to purge order_details, then orders, and then re-load orders and order_details.

    Another option is to use a lookup and send the "error" rows (rows without a match) to the table and discard the other rows.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply