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 2000 Forums
 SQL Server Development (2000)
 Update Differences between 2 tables

Author  Topic 

misterzr
Starting Member

49 Posts

Posted - 2006-01-06 : 09:17:19
I have 2 tables with the exact same columns and formatting that I am trying to update the different records from one to the other.

Any Ideas

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-01-06 : 09:24:46

Update T1
Set T1.col=T2.col....
from Table1 T1 inner join Table2 T2
on T1.keycol=T2.keycol

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

misterzr
Starting Member

49 Posts

Posted - 2006-01-06 : 09:45:53
Do I have to name each column individually to update the other table?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-01-06 : 09:50:00
Yes if you want to update more columns

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

misterzr
Starting Member

49 Posts

Posted - 2006-01-06 : 09:59:33
This doesn't quite work for what I am trying. I have some different rows between the two tables and am just trying to update the different rows from one to the other
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-01-09 : 02:37:23
Do you want to insert the records to table1 that are not in table2?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -