How To Update From Using T-SQL



TODO:

Have you ever wanted to perform a join during an Update using T-SQL?

 

SOLUTION:

UPDATE
    Person
SET
    Person.Name = PersonArchive.Name
FROM
    Person
INNER JOIN
    PersonArchive
ON
    Person.Id = PersonArchive.Id

 

NOTES:

You can also add a WHERE clause as to not update all records.



Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading