Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

two source table columns to one destination table Expand / Collapse
Author
Message
Posted Friday, December 3, 2010 3:05 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, April 25, 2012 5:55 AM
Points: 19, Visits: 69
Hi

i have table tab1 with columns a,b,c and table tab2 with columns x,y,z now i have to load the data into tab3 with columns a,b,x,y

so i have created two oledb sources (tab1 & tab2) and a oledb desitination(tab3) now which transformation should i use to get two columns(a,b) form tab1 and two columns(x,y) from tab2 and load into destination table tab3(a,b,x,y)


please let me know how to achieve this
Post #1029725
Posted Friday, December 3, 2010 3:17 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 8:25 AM
Points: 4,983, Visits: 11,675
Feed the two sources into a Merge Join transformation and from there map to your destination table (I'm assuming that the two source tables can be joined, of course).


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1029726
Posted Friday, December 3, 2010 3:19 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 8:25 AM
Points: 4,983, Visits: 11,675
Or ...

Instead of using the tables as your sources, use a query which includes the join. Then your data source is ready to go - this will be faster than MERGE JOIN in SSIS.



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1029727
Posted Friday, December 3, 2010 3:44 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, April 25, 2012 5:55 AM
Points: 19, Visits: 69
Phil Parkin (12/3/2010)
Or ...

Instead of using the tables as your sources, use a query which includes the join. Then your data source is ready to go - this will be faster than MERGE JOIN in SSIS.


HI Thanks for the reply
it worked by selecting outer join but out put is

12 10 NULL NULL
NULL NULL 66 667
NULL NULL 98 665
377 467 NULL NULL
1231 56 NULL NULL

iam expecting the below one
a b x y
12 10 66 667
377 467 98 665
1231 56 NULL NULL

how to get like the above one
Post #1029732
Posted Friday, December 3, 2010 4:06 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 8:25 AM
Points: 4,983, Visits: 11,675
If you have two data sets

Set 1
1, 2
3, 4

Set 2
a, b
c, d

and you want to combine them to give something like

1, 2, a, b
3, 4, c, d

you need to find a way of linking set 1 and set 2. Otherwise who is to say that

1, 2, c, d
3, 4, a, b

is not correct?

So ... what is the link between your source data tables?



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1029739
Posted Friday, December 3, 2010 4:33 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, April 25, 2012 5:55 AM
Points: 19, Visits: 69
thanks a ton now i got it u mean to say that there should be a common key to join both the tables
Post #1029750
Posted Friday, December 3, 2010 4:37 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 8:25 AM
Points: 4,983, Visits: 11,675
Yes exactly. Once you have that, you're in business.

Even if you just use Row_Number() to generate one on the fly ... (if you're not too fussy about which rows end up together).



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1029752
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse