4

我从删除 SSIS 数据流中的重复项中学到了如何使用排序转换来删除具有重复数据值的行。

就我而言,我正在读取一个分隔文件,需要消除重复项,并记录具有重复键的行。我需要将这些行输出到另一个分隔文件,并将其通过电子邮件发送回客户,以便他们更正数据并重试。

不过,我无法完全弄清楚如何做到这一点。我将尝试使用 Aggregate 和 Merge Join,但我希望有一个已知的模式可以做到这一点。

4

3 回答 3

6

Hi my answer gonna work with any data, because some solutions in internet need primary key of rows, for my solution primary key is not required. Here sample structure and sample dataset:

a   b
1   23
1   23
16  59
12  12
13  45
12  12
45  56

enter image description here

Just group by all columns and add last column - count all (If there are more than two columns or more, you just need in "Aggregate" element put all columns and foreach set group by and in the end put "Count All" column):

enter image description here

Then just add conditional split element and take all rows where are more than 1 same row:

enter image description here

Real Example:

enter image description here

于 2012-09-06T21:05:50.010 回答
2

通过博客上的一些选项从数据流中删除重复项,这里有一个关于如何“保存”重复行以进行备用处理的小脚注。

于 2012-09-08T16:10:59.677 回答
0

可能通过脚本实现。

首先,您将使用脚本遍历数据集并以编程方式识别重复项。然后,您可以将条目写入日志文件以查找您发现的骗子

于 2012-09-06T20:55:52.630 回答