如何在此查询中打印由该查询更新的行:
update
Table1.RecommendationLeg
set
actualValue = ( leg.actualprice * str.currentSize)
from
Table1.RecommendationLeg leg
inner join Recommendation str
on leg.partofId = str.id
where
leg.actualValue = 0
and datediff( n, timeOf, CURRENT_TIMESTAMP) > 30
最佳答案
update
Table1.RecommendationLeg
set
actualValue = ( leg.actualprice * str.currentSize)
OUTPUT INSERTED.actualValue -- <-- this. Edit, after SET not UPDATE. Oops. Sorry.
from
Table1.RecommendationLeg leg
inner join Recommendation str
on leg.partofId = str.id
where
leg.actualValue = 0
and datediff( n, timeOf, CURRENT_TIMESTAMP) > 30
关于sql-server-2008 - T-SQL输出更新结果,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4628550/