优先于列数据删除 SSIS 包中的重复项

编程入门 行业动态 更新时间:2024-10-26 18:27:44
本文介绍了优先于列数据删除 SSIS 包中的重复项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在来自 Excel 工作表的数据中有重复的行.在 SSIS 包中,我使用排序转换,其中按主键列 ID 以升序进行排序.但在删除重复项之前,我想查看电子邮件列是否包含我公司域的电子邮件.如果是这样,我希望删除除具有此类电子邮件地址的行之外的其他行.我该怎么办?请参考下面的图片.

I have duplicate rows in data coming from excel sheet. In the SSIS package, I am using Sort transformation where sorting is done in ascending order by the primary key column ID. But before removing the duplicates I want to see if the email column has email with my company's domain. If so, I want other rows removed than the one having this type of email addresses. What should I do? Please refer to the image attached below.

在上面的数据中,我想删除电子邮件地址为 john@gmail 的两行 John.在 Maria 的情况下,我想删除电子邮件地址为 maria@gmail 的两行,从而保留电子邮件地址为域 mycompany 的行.如果用户的电子邮件地址为域 mycompany 的用户有多行,我想保留域电子邮件地址的任何一行.

In the data above, I want to remove two rows of John where email address are john@gmail. In Maria's case, I want to remove two rows having email addresses maria@gmail, hence preserving rows having email addresses of the domain mycompany. If there are multiple rows for a user having email addresses of the domain mycompany, I want to keep any one row with the domain email address.

请提出建议.

推荐答案

你可以像 Kobi 展示的那样在 sql 中做到这一点,这可能更容易.但是,如果您更喜欢 ssis:

you can do that in sql like Kobi showed, that may be easier. But if you prefer in ssis:

我的测试数据:

几点:

有条件的拆分:首先将带有 mycompany 的行和没有的行分开.

Conditional split: First you separate rows with mycompany and those without.

排序和 non_mycompany 排序:根据 id 对两个输出进行排序并删除重复项.

Sort and non_mycompany sort: sort both output on id and remove duplicates.

mycompany_multicast:用 mycompany 创建两个行的副本

mycompany_multicast: create two copy of rows with mycompany

合并连接:将没有 mycompany 的行左连接到有 mycompany 的行.注意连接顺序,目的是获取没有 mycompany 的行,并且在有 mycompany 的行中没有匹配的 id.

Merge join: left join rows without mycompany to rows with mycompany. Note the join order, the purpose is to get rows without mycompany and no matching id in rows with mycompany.

条件拆分 1:采用没有 mycompany 的行并且在有 mycompany 的行中没有匹配的 id.您可以使用 mycompany 从行中检查 id,如果 id 为空,则该行在与 mycompany 的行中没有匹配项.

Conditional split1: take rows without mycompany and no matching id in rows with mycompany. you can check id from rows with mycompany, if the id is null then the row has no matching in rows with mycompany.

union all:union 最终结果

union all: union the final result

更多推荐

优先于列数据删除 SSIS 包中的重复项

本文发布于:2023-10-27 16:14:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1533892.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:包中   数据   SSIS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!