declare cursor_name cursor for select * from table
open cursor_name
fetch cursor_name into 变量
while @@sqlstatus=0
begin
处理数据...
fetch cursor_name into 变量
end
close cursor_name
deallocate cursor cursor_name
declare cursor_name cursor for select * from table
open cursor_name
fetch cursor_name into 变量
while @@sqlstatus=0
begin
处理数据...
fetch cursor_name into 变量
end
close cursor_name
deallocate cursor cursor_name