SSIS 2012 - 插入新行,忽略现有行 [英] SSIS 2012 - Insert new rows, ignore existing rows

查看:38
本文介绍了SSIS 2012 - 插入新行,忽略现有行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从我使用 SSIS 已经很长时间了.我正在使用 SSIS 2012.我想将一个表中的行插入到另一个表中.但是,我只想根据主键将源中的行插入目标中,而目标中不存在的行.对于现有的行,我想简单地忽略源中的行.我知道将行从一个表插入到另一个表是一件简单的事情,但是检查源中的行是否存在于目标中并忽略它的最佳(最有效)方法是什么?

It has been quite a long time since I've used SSIS. I'm using SSIS 2012. I'd like to insert rows from one table into another table. But, I'd like to only insert rows from the source, into the destination, that don't exist in the destination, based on the primary key. For existing rows, I'd like to simply ignore the rows from the source. I know it's a simple matter to insert rows from one table to another, but what's the best (most efficient) way to check to see if a row from the source exists in the destination and ignore it if it does?

推荐答案

在源组件和目标组件之间,添加查找组件.

Between your source and destination component, add a Lookup Component.

将查找配置为重定向到不匹配行的无匹配输出.

Configure the Lookup to Redirect to No Match Output for unmatched rows.

在您的查找源中,编写一个类似 SELECT T.PK1, T.PK2 FROM dbo.MyTable T 的查询,其中您只需拉回主键,然后将您输入的数据与目标表的数据进行比较.

In your lookup source, write a query like SELECT T.PK1, T.PK2 FROM dbo.MyTable T where you only pull back the primary keys and then compare you input data to the target table's.

不匹配输出的结果将是目标中不存在的行.

What comes out of the no match output will be rows that do not exists in the destination.

2008 年问题的示例屏幕截图

Sample screenshots for a 2008 problem

导入大SSIS 中带有排序和连接的数据文件

这篇关于SSIS 2012 - 插入新行,忽略现有行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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