当前位置: 代码迷 >> Sql Server >> update 中字段取值的有关问题
  详细解决方案

update 中字段取值的有关问题

热度:27   发布时间:2016-04-27 12:41:10.0
update 中字段取值的问题。

update table1 set vol = vol + 20, set Amount = price * vol where ...

这时 Amount中的vol是加过20的还是没加过20的?有什么说法?

------解决方案--------------------
没加20的,

update table1 set vol = vol + 20,Amount = price * (vol+20) where ...

------解决方案--------------------
沒加過的,同時進行的
------解决方案--------------------
原因他們取的值都是deleted表中的值,而不是取的inserted表中的值
  相关解决方案