忽略 SSIS 的 OLE DB 目标中的重复记录 [英] Ignore duplicate records in SSIS' OLE DB destination

查看:29
本文介绍了忽略 SSIS 的 OLE DB 目标中的重复记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 OLE DB 目标用来自网络服务的值填充表.

I'm using a OLE DB Destination to populate a table with value from a webservice.

该软件包将被安排在前一天的凌晨运行.但是,如果失败,可以手动执行该包.

The package will be scheduled to run in the early AM for the prior day's activity. However, if this fails, the package can be executed manually.

我担心的是,如果操作员选择的日期范围与现有数据重叠,则整个包将失败(已验证).

My concern is if the operator chooses a date range that over-laps existing data, the whole package will fail (verified).

我愿意:

  • 插入缺失值(如果没有重复,则按预期工作)
  • 忽略重复项;不会导致包失败;引发可由 Windows 应用程序日志捕获的异常(记录为警告)
  • 收集成功插入的记录数和重复数

如果重要,我正在使用数据访问模式 = 表格或视图 - 快速加载

If it matters, I'm using Data access mode = Table or view - fast load and

感谢有关如何实现这一目标的建议.

Suggestions on how to achieve this are appreciated.

推荐答案

我会这样做:

  • 将您的 SSIS 目标指向一个空的临时表当包运行时.

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

将所有行插入临时表.

运行一个使用 SQL 从数据库中导入记录的存储过程暂存表到最终目标表,记录不存在的地方已存在于目标表中.

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.

(最后 3 个步骤将在同一个存储过程中完成).

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

这篇关于忽略 SSIS 的 OLE DB 目标中的重复记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆