How to join the columns from two tables.
Hi
Im new SSIS, writting this simple package for more than a week.
My problem is, Im reading a XML from a file and store them into my SQL Server tables.Everything is fine except one place, where i have two subtags under a parent tag, which was returned as two tables but i want to store them into single table.These two tables
returned by y xml doesnt have any key common between them.
so my question is, how to merge these two tables to get a single dataset as result.
Example:
sample XML will be like this
<root>
<TableA>
<ColA>Raj</ColA>
<ColB>12</ColB>
<TableA>
<TableB>
<ColC>200</ColC>
<ColD>Y</ColD>
<TableB>
</root>
<root>
<TableA>
<ColA>Ram</ColA>
<ColB>1</ColB>
<TableA>
<TableB>
<ColC>400</ColC>
<ColD>N</ColD>
<TableB>
</root>
After Reading using XMl source it looks like
Table A
ColA ColB
Raj 12
Ram 1
Table B
ColC ColD
200 Y
400 N
Result Data Set Should be like
ColA ColB ColC ColD
Raj 12 200 Y
Ram 1 400 N
I dont know whether it is possible by using any of the SSIS Transformation.
Thanks in advance.
Regards,
RajThanks in Advance friends!!.. Rajkumar.
June 17th, 2011 12:42am
Merge Join transformation?
http://www.bimonkey.com/2010/10/the-merge-join-transformation/James Beresford @ www.bimonkey.com
SSIS / MSBI Consultant in Sydney, Australia
SSIS ETL Execution Control and Management Framework @
SSIS ETL Framework on Codeplex
Free Windows Admin Tool Kit Click here and download it now
June 17th, 2011 1:16am
Hi James,
I considered the Merge Join Transformation but that Requires a common key between the two datasets, which i dont have in my case..
Any other way to do it...Thanks in Advance friends!!.. Rajkumar.
June 17th, 2011 1:56am
How then would you decide which rows from Table A get joined to which rows from Table B? By row "number"?
If that's the case, then you need to generate a row number for each table - you can use the RANK function in T-SQL, or use a
custom component or script component to add them. Sort each flow by that number, then use the Merge Join.
Talk to me now on
Free Windows Admin Tool Kit Click here and download it now
June 20th, 2011 3:39pm