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.
| Author |
Topic |
|
h2sut
Starting Member
40 Posts |
Posted - 2008-10-06 : 15:16:04
|
| I have two table. Table A and Table B. Is there a way when i run my SSIS package to update Table b wiht the information from A. Table A has 60 users and table B has 100. So i would update table B with the new infromation from A. |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2008-10-06 : 15:23:22
|
| please provide more information.tablestruktur.columns to match (join) records in table a / table b.columns to update.Then, when you have a sql-statement, you can take it to your package.GreetingswebfredPlanning replaces chance by mistake |
 |
|
|
h2sut
Starting Member
40 Posts |
Posted - 2008-10-06 : 16:27:18
|
| Okay Table A hasdate ,userid, Fname1 2 John1 3 FrankOkay Table B hasdate, userid,Fname2 2 John3 3 FrankSO my final resuts would be from A after it updates the file |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2008-10-06 : 16:40:24
|
| -- create temp tables for testcreate table #table_a(date int,userid int,Fname varchar(30))create table #table_b(date int,userid int,Fname varchar(30))-- insert test-datainsert #table_aselect 1,2,'John' unionselect 1,3,'Frank'insert #table_bselect 2,2,'John' unionselect 3,3,'Frank'-- show test-data before updateselect * from #table_aselect * from #table_b-- updateupdate bset date = a.datefrom #table_b as bjoin #table_a as a on (a.userid = b.userid)-- show test-data after updateselect * from #table_aselect * from #table_b-- cleaningdrop table #table_adrop table #table_bPlanning replaces chance by mistake |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-10-06 : 16:45:02
|
| Put this in Execute SQL task and run it through SSISUPDATE bSET b.date=t.date,........FROM table1 tINNER JOIN table2 bON b.date=t.dateAND b.userid=t.useridand b.Fname= t.Fname |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2008-10-06 : 16:49:18
|
| Hi sodeep,first i want to know, whats wrong with my solution and second:ON b.date = t.date will not work...webfredPlanning replaces chance by mistake |
 |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2008-10-07 : 12:12:18
|
| FYI, You can also do this through the Slowly Chaning Dimension control or the Lookup control. |
 |
|
|
|
|
|
|
|