语法:
update table1 set table1.列=table2.列 from table2 where table2.列=table1.列
update 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
update 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 A
SET foo = B.bar
FROM TableA A
JOIN TableB B
ON A.col1 = B.colx
WHERE ...
JOIN TableB B
ON A.col1 = B.colx
WHERE ...