我用这种方式锁定记录:
UPDATE TOP (10) TABLEA SET STATUS = 5
OUTPUT inserted.*
FROM TABLEA A
INNER JOIN TABLEB B
ON A.EMAIL = B.VALUE
现在,是否可以返回已连接表的值?
答案 0 :(得分:1)
DECLARE @T TABLE (Status INT)
UPDATE A
SET STATUS = 5
OUTPUT inserted.STATUS INTO @T(Status)
FROM TABLEA A INNER JOIN TABLEB B
ON A.EMAIL = B.VALUE
SELECT * FROM @T