Update Multiple Columns in SQL Server

Here we want to update EmployeeNumber in Table1 from EmployeeNumber in Table2 where the id is 108912.

UPDATE tbl1 
SET    tbl1.employeenumber = tbl2.employeenumber 
FROM   table1 tbl1 
       LEFT JOIN table2 tbl2 
              ON tbl2.id = tbl1.id 
WHERE  tbl2.id = '108912' 

[topads][/topads]

Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.