两个数据源的笛卡尔积 [英] cartesian product of two data sources

查看:141
本文介绍了两个数据源的笛卡尔积的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我在SSIS中有两个数据源。

Let's say I have two data sources in SSIS.

表A有10行,其中两列为空。
表B有20行,每行两列。

Table A has 10 rows and two of the columns are empty. Table B has 20 rows with two columns each.

我想以某种特定方式将它们加入ETL流程:
表A的行,将使用表B的两列的值生成20行。

I want to somehow join them in an ETL process in a specific way: for each row of table A, 20 rows are generated with the values for the two columns from table B.

这种方式应生成200行,并且每行可能组合表A和B

This way 200 rows should be generated with every possible combination of the rows from tables A and B

我尝试使用合并联接和并集部分,但是它们不起作用...有解决此问题的想法吗?

I tried using Merge Join and Union pieces, but they won't work... Any ideas how to fix this?

推荐答案

向两个源添加相同的列,并为其分配相同的值,例如1。因此,table1中的所有10行和table2中的所有20行都具有该列的值为 1。现在,当您执行合并联接时,将联接类型保持为完全外部联接 Voila!,则您有个交叉连接。请记住,对于 SSIS ,需要在该列上对源进行排序,以进行合并联接,否则会引发错误。

Add an identical column to both the sources and assign it the same value, say 1. So all the 10 rows in table1 and 20 rows in table2 have the value of "1" for that column. When you now do a merge join, keeping the join type as full outer join, Voila!, you have your cross join. Do keep in mind, the sources need to be sorted on that column for SSIS to go ahead with the Merge join, else it would throw an error.

这篇关于两个数据源的笛卡尔积的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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