昨天的问题.更新异常
update web_user_doorguest set current_datetime=factdatetime,lev=lev+1, [force]=[force]+case when @rand<60 then 1 else case when @rand<85 and @rand>60 then 2 else 3 end end
,[recovery]=[recovery]+case when @rand1<50 then 0 else 1 end ,
[agility]=[agility]+case when @rand2<50 then 0 else 1 end
,[mind]=[mind]+case when @rand3<50 then 0 else 1 end ,
[life]=[life]+case when @rand4<50 then 50 else case when @rand<85 and @rand>50 then 52 else 55 end end where [id]=@id
发现case when 语句,有时会出现问题,就是有的会不执行.
例如force列肯定会加一个数,但有时就不加..是放在服务器上执行.
另外..
update web_user_doorguest set web_user_doorguest.current_life=(case when arm_count>0 then b.current_life else 0 end),web_user_doorguest.state=(case when arm_count>0 then 1 else 5 end)
from #war_temp b where web_user_doorguest.id=b.id and b.type_id=20
还会出现current_life=0,但是state=1的情况.