How to empty my destination table before inserting new records in SSIS?

后端 未结 4 1641
清歌不尽
清歌不尽 2021-02-03 23:15

I use SSIS to generate and transform new data for later use in a new system. I have a problem every time I run my SSIS Package, it keeps inserting new records to my destination

4条回答
  •  攒了一身酷
    2021-02-04 00:04

    Create an Execute SQL task. Have it run first. For the sqlstatment do.

    Truncate table DestTable
    

    Using truncate table is better then using delete as it ignores all the indexes and just removes everything.

    For a little background info. I will try and explain why you should use truncate table instead of delete table. Delete table is a row based operation this means that each row is deleted. Truncate table is a data page operation the entire data page is delocated. If you have a table with a million rows it will be much faster to truncate the table then it would be to use a delete table statment.

提交回复
热议问题