open cstucou
--打开游标
fetch next from cstucou into @stuno
[email protected],当小于剩余名额时(@不<=@limitnum-@choosenum)继续分配
set @i=1
while @@fetch_status=0 and @i<=@limitnum-@choosenum
begin
update stucou set state='选中'where current of cstucou
set @[email protected]+1fetch next from cstucou into @couno
end
红色的语句是什么意思?
------解决方案--------------------
[email protected]
循环.如果成功 并且 @I<....条件成立
更新表的state为选中。条件是当前游标的读取的值
[email protected]
------解决方案--------------------
[email protected],当小于剩余名额时(@不<=@limitnum-@choosenum)继续分配
说的很明白了。
------解决方案--------------------