Ignore duplicate records in SSIS' OLE DB destination

旧城冷巷雨未停 提交于 2019-12-05 20:17:39

Here's how I would do it:

  • Point your SSIS Destination to a staging table that will be empty when the package is run.

  • Insert all rows into the staging table.

  • Run a stored procedure that uses SQL to import records from the staging table to the final destination table, WHERE the records don't already exist in the destination table.

  • Collect the desired meta-data and do whatever you want with it.

  • Empty the staging table for the next use.

(Those last 3 steps would all be done in the same stored procedure).

That's not a feature.

If you don't want error (duplicates), then you need to defend against it - much as you'd do in your favorite language. Instead of relying on error handling, you test for the existence of the error inducing thing (Lookup Transform to identify existence of row in destination) and then filter the duplicates out (Redirect No Match Output).

The technical solution you absolutely should not implement

Change the access mode from the "Table or View Name - Fast Load" to "Table or View Name". This changes the method of insert from a bulk/set-based operation to singleton inserts. By inserting one row at a time, this will allow the SSIS package to evaluate the success/fail of each row's save. You then need to go into the advanced editor, your screenshot, and change the Error disposition from Fail Component to Ignore Failure

This solution should not used as it yields poor performance, generates unnecessary work load and has the potential to mask other save errors beyond just "duplicates" - referential integrity violations for example

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!