How Intersect and Except result in SSIS

て烟熏妆下的殇ゞ 提交于 2020-01-04 06:52:56

问题


Have Two result Set A and B, In SSIS Merge Join how get EXCEPT and INTERSECT of A result set.

Bellow sql syntax return desired out put:

---Insersect
select a.* from A a Inner join B b on a.Key=b.Key 

--Except
select a.* from A a left join B b on a.Key=b.Key where b.Key is null

How to get those query result from SSIS merge join


回答1:


According to his Microsoft Artcile, "The Merge Join transformation provides an output that is generated by joining two sorted datasets using a FULL, LEFT, or INNER join"

In the Merge Join Transformation editor, you can select the Join Type property to do that:

Except:

select a.* from A a left join B b on a.Key=b.Key where b.Key is null

You have to set Join Type = Left Outer Join, and after the Merge Join Transformation you have to add a conditional split to filter rows that has b.Key is null

Follow this detailed article for that: Get all from Table A that isn't in Table B

Intersect

select a.* from A a Inner join B b on a.Key=b.Key

You have to set Join Type = Inner Join

Follow this article for that: Inner join in SSIS



来源:https://stackoverflow.com/questions/47880137/how-intersect-and-except-result-in-ssis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!