日期:2014-05-18  浏览次数:20407 次

记录查询问题..
比如有一个表中有10万条记录,按照某个条件查询(如日期)时能得到一些记录,   我要对每个查询到的记录做操作,该如何处理呢,可以不用建临时表吗??是不是用while循环??

------解决方案--------------------
declare tb cursor for select name,startno,endno from from tablea where .....

open tb
fetch next from tb into ....
while @@fetch_status=0
begin
......

fetch next from tb into ...
end
close tb
deallocate tb

------解决方案--------------------
用游标吧,但是效率低