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
 General SQL Server Forums
 New to SQL Server Programming
 Update Table

Author  Topic 

chriztoph
Posting Yak Master

184 Posts

Posted - 2010-09-28 : 22:27:40
Hi everyone!

How to update a table

like this;

UPDATE Table_2
SET Table_2.TypeID = Table_1.TypeID
WHERE Table_2.Name = Table_1.Name

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2010-09-28 : 23:02:18
Here's one way:

update t2 set
t2.typeid = t1.typeid
from table_1 t1
inner join table_2 t2
on t2.name = t1.name


Be One with the Optimizer
TG
Go to Top of Page

chriztoph
Posting Yak Master

184 Posts

Posted - 2010-09-29 : 00:18:38
Thanks TG
Go to Top of Page
   

- Advertisement -