用下面的语句更新就可以了.declare @cfid int,@cfmx
update 你的表 set @cfmx=case @cfid when cfid then @cfmx+1 else 1 end
                 ,cfmx=@cfmx,@cfid=cfid