Today I needed to update one of the tables in my database replacing the value in one field with a derived value from another table. A quick search on the internet turned up this useful post from Ben Nadel
Essentially the statment required is as follows:
UPDATE A
SET DestinationField = B.SourceField
FROM TableToUpdate A
INNER JOIN TableToReadFrom B
ON A.JoinKey = B.JoinKey
Wednesday, 8 July 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment