我正在对表进行更新,需要获取更新前的字段值和更新后的字段值。我从已删除的表中获取更新前的值,从插入的表中获取更新后的值(见下文)。这是正确的方法吗?
insert into [log].[userPoints]
(accountId,oldPoints,newPoints)
SELECT del.accountId, del.points, i.points
FROM [user].[Points] AS p
INNER JOIN deleted AS del ON del.accountId = p.accountId
inner join inserted as i on i.accountId = p.accountId