Update Tablea
Set Tablea.description=TableB.description
from Tablea
inner join Tableb
on Tablea.xxx=TableB.xxx
And Tablea.yyy=TableB.yyy
And Tablea.zzz=TableB.zzz
You'll need to define "where record exists in both tables".
The simplest syntax for this would be...
Code:
Update TableA
Set TableA.description = TableB.Description
From TableA
Inner Join TableB
On TableA.IdColumn = TableB.IdColumn
Notice the ON clause. You'll need to define how the rows from each table are matched. Also, it's usually best to write a select query before actually updating the data. Something like this...
Code:
--Update TableA
--Set TableA.description = TableB.Description
Select TableA.IdColumn,
TableA.Description,
TableB.Description
From TableA
Inner Join TableB
On TableA.IdColumn = TableB.IdColumn
Once you get the select working (to show the correct data), comment the select and uncomment the Update and Set lines.
-George
Microsoft SQL Server MVP My Blogs SQLCop
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.