UPDATE dbo.rsl_mb_coupon_use WITH ( ROWLOCK )
SET
status = 0 ,
EditDate = GETDATE() ,
AddDate = GETDATE() ,
OUTPUT deleted.coupon_no --注意重要代码
INTO #Temp --注意重要代码
WHERE coupon_no IN ( SELECT TOP ( @qty )
coupon_no
FROM rsl_mb_coupon_use
WHERE memid IS NULL
AND status = 8
AND distrioffice = 3 );
SELECT @RowCount1 = @@ROWCOUNT;