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'

 

Esau Silva
Software Engineer at Region One ESC
Full Stack Software Engineer working with Microsoft technologies, ReactJS is awesome and avid Brazilian Jiu-Jitsu practitioner
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed.
Share