UPDATE dbo.A
SET StatusCode = 'booked'
, UpdateDate = GETDATE()
OUTPUT INSERTED.id INTO @TableVar
WHERE id = (
SELECT TOP 1 wq.id
FROM dbo.A AS wq
WHERE wq.statusCode = 'Claimed' and wq.id = 2
)
我需要更新 id 等于 2 且 statusCode 等于 'Claimed' 的表 A 更新为 'booked'
它是线程安全的吗?tks