我有一条更新声明
Merge [dbo].[Profiles] AS P
using Staging.[AWSProfiles] AS S
ON P.PIN = S.PIN
WHEN Matched THEN UPDATE SET
P.[FirstName] = S.[FirstName]
,P.[LastName] = S.[LastName]
,P.[SupervisorLastName] = S.[SupervisorLastName]
,P.[SupervisorFirstName] = S.[SupervisorFirstName]
,P.[SupervisorPin] = S.[SupervisorPin]
在表Profiles
中,我有一个名为EmployeeStatusChangeDate
的字段。每当GETDATE()
(EmployeeStatus
的字段从“活动”变为“临时退出”
AWSProfiles
。
AWSProfiles列
FirstName
LastName
SupervisorLastName
SupervisorFirstName
SupervisorPin
EmployeeStatus
个人资料列
FirstName
LastName
SupervisorLastName
SupervisorFirstName
SupervisorPin
EmployeeStatusChangeDate
如何在更新声明中做到这一点?