我面临这样一种情况,我已经构建了 SSIS 包来整合来自多个数据库的表,但有时 DBA 会手动从源表中删除记录。如果记录被删除,有什么方法可以在合并表上检测?我知道我可以在包运行之前每次截断合并表,但我想知道是否有另一种方法?
问问题
1495 次
2 回答
1
我在 SQL Server Central的集成服务阶梯系列中演示了一种管理删除目标中已在源中删除的数据的方法。
希望这会有所帮助,安迪
于 2012-03-08T22:46:34.283 回答
0
I thought of several solutions, but I realize now the big issue is that you don’t have an unified data source, so a record may not exist in A but exist in B, thus you can’t delete it.
So my suggestion is, after you inserted, run a select distinct(id) from all sources and put them together on a structure (table, temp table, view, UNION, whatever..) and run a Merge from this source into destination on the IDs with only a WHEN NOT MATCHED THEN DELETE.
于 2012-03-09T09:54:53.700 回答