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

Author  Topic 

magic-support.nl
Starting Member

2 Posts

Posted - 2006-05-27 : 10:50:41
Hello all,

I'm new to the group and new with SQL in general.
I have a question: I have 2 tables in a database A & B
They have a foreign key named: 'ID' A is a one to many with B.
In table A a collumn CD is used. This collumn is alse available in table B.
Now I want to change all rows in table B, collumn CD with the value of collumn CD from table A.

I've found some instruction like UPDATE etc. but they remind me of using one table.

Maybe someone can help me around.

Thx

Robert

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-05-27 : 20:28:54
[code]update b
set b.CD = a.CD
from tableA a inner join tableB b
on a.ID = b.ID[/code]


KH

Go to Top of Page

magic-support.nl
Starting Member

2 Posts

Posted - 2006-05-28 : 15:13:28
Thx for the help.
Will try asap.

Robert
Go to Top of Page
   

- Advertisement -