注意要加括号,在更改多个列的时候
ALTER proc usp_clearActiveScoreCalcCommentScore
as
begin
update tbForum set UltimoScore=
(case
when AllScore-RemainScore<0 then 0
else AllScore-RemainScore
end),AllScore=
(case
when ActivityDegree>=0 and ActivityDegree<=300 then 250
when ActivityDegree>=301 and ActivityDegree<=800 then 500
when ActivityDegree>=801 and ActivityDegree<=2000 then 1000
when ActivityDegree>=2001 and ActivityDegree<=4000 then 2000
when ActivityDegree>=4001 and ActivityDegree<=8000 then 4500
when ActivityDegree>8000 then 9000
end),UltimoDegree=ActivityDegree,ActivityDegree = 0
update tbForum set RemainScore=AllScore
end