循环里面没有移动游标,为什么不这样
WHILE (@@fetch_status=0)
begin
if @j_money<@d_money
update mxz set jd='借' where pzzh is not null and pzzh<>''
else
update mxz set jd='贷' where pzzh is not null and pzzh<>''
fetch next from cc into @j_money,@d_money,@pzzh
end
而且Where条件有问题,@pzzh应该为pzzh
WHILE (@@fetch_status=0)
begin
if @j_money<@d_money
update mxz set jd='借' where pzzh is not null and pzzh<>''
else
update mxz set jd='贷' where pzzh is not null and pzzh<>''
fetch next from cc into @j_money,@d_money,@pzzh
end
而且Where条件有问题,@pzzh应该为pzzh
“必须声明变量 '@j'。”