语法:
update table1 set table1.列=table2.列 from table2 where table2.列=table1.列
update NFYSP.dbo.PATIENT set
PATIENT_ADDUSERID=OLD.PATIENT_ADDUSERID
,PATIENT_UPDATEUSERID=OLD.PATIENT_UPDATEUSERID
,PATIENT_UPDATEUSERNAME=OLD.PATIENT_UPDATEUSERNAME
,PATIENT_ADDUSERNAME=OLD.PATIENT_ADDUSERNAME
from CRM_XJP.dbo.PATIENT OLD where PATIENT.id=OLD.id
在更改时使用Join
UPDATE ASET foo = B.barFROM
TableA A
JOIN TableB B
ON A.col1 = B.colx
WHERE ...
参考:http://*.com/questions/982919/sql-update-query-using-joins