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 2005 Forums
 Other SQL Server Topics (2005)
 Replacing Data of other table

Author  Topic 

prettymom
Starting Member

1 Post

Posted - 2011-06-08 : 01:33:21
Hi,

Please help me building my script.

I need to replace all the data in the columns of table A,
that has same primary key to table B.

example:

Table A

column = pn stock1
a 1

Table B

column = pn stock1
a 2

I need to make the data of table B replace the data of table A if they have the same PN.

Thanks,
Rexa

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-06-08 : 08:00:20
[code]UPDATE A SET
col1 = B.col1
FROM
TableA A
INNER JOIN TableB B on A.PN = B.PN[/code]
Go to Top of Page
   

- Advertisement -