Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Three Source tables and one Target

Author  Topic 

jscot
Posting Yak Master

106 Posts

Posted - 2010-11-14 : 17:59:01
Hi all gurus!

I need advise. I have three different source i.e
Table "A"
ID,LNAME,FNAME
TABLE "B"
E.MAIL,ADD,CITY
TABLE "C"
STATE,ZIP,PH

and my Target table is

Table "Target"
ID,CITY,PH,LNAME.

Note:- I don't have any connection b/w source tables. How can i Handle this issue in SSIS.
OR
How i can join all tables in SQL. "Table "A" + Table "B" + Table "C" in one new table "Table "Source" and then use one source and one target.

Thanks in advance.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-11-14 : 21:20:18
If there is no connection between the 3 tables, then there is no way to do this except to randomly mix them up. You can't join them, since you don't have a linking column.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

jscot
Posting Yak Master

106 Posts

Posted - 2010-11-15 : 20:39:47
Thanks for your reply. I don't want to link them, i just want to use only source table and one target table. Its easy for me populate my tables. Any advise?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-11-15 : 23:32:43
In order to join them, you have to link them. There is no magic here.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

jscot
Posting Yak Master

106 Posts

Posted - 2010-11-17 : 22:21:11
You are 200% right, finally i find out the link. Now my question is How i can join two table to make one source table. For example:-

Table "A"
ID,LNAME,FNAME => Total Rows = 35
TABLE "B"
E.MAIL,ADD,CITY,ID => Total Rows = 175
TABLE "C"
STATE,ZIP,PH,ID => Total Rows = 85

End Result should be like this:-

Source Table

ID,Ph,EMAIL,LNAME

Note:- I want to create a physical table.

Thanks for your help.Please let me know if my question is not clear!
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-11-17 : 23:23:37
Here's the query to produce the result set:
SELECT a.ID, c.PH, b.EMAIL, a.LNAME
FROM TableA a
JOIN TableB b
ON a.ID = b.ID
JOIN TableC c
ON b.ID = c.ID

Now we use that to build the physical table:
SELECT a.ID, c.PH, b.EMAIL, a.LNAME
INTO NewTableNameGoesHere
FROM TableA a
JOIN TableB b
ON a.ID = b.ID
JOIN TableC c
ON b.ID = c.ID

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

jscot
Posting Yak Master

106 Posts

Posted - 2010-11-17 : 23:28:42
You are the Man! Thanks for your Prompt Reply and Help!
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-11-18 : 01:06:32
I am the woman!

You're welcome, glad to help.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

jscot
Posting Yak Master

106 Posts

Posted - 2010-11-18 : 22:32:39
ohhh sorry!.
Go to Top of Page
   

- Advertisement -