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 |
sqlfresher2k7
Aged Yak Warrior
623 Posts |
Posted - 2007-08-22 : 10:53:43
|
I have two database which contains same structure.I want to compare the data from same tables of two different databases which has same id and run an update query.Database1table1:Tid pno--- ---1 562 593 684 985 45Database2table1:Tid pno--- ---1 662 893 484 885 556 967 488 169 25 Output:Database2table1:Tid pno--- ---1 562 593 684 985 456 967 488 169 25 Thanks for your help in advance!!!!! |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-08-22 : 11:00:30
|
[code]UPDATE tSET pno = s.pnoFROM database2.dbo.table1 t INNER JOIN database1.dbo.table1ON t.tid = s.tid[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
sqldba2k6
Posting Yak Master
176 Posts |
Posted - 2007-08-22 : 11:38:46
|
Thanks KH! |
 |
|
|
|
|