sybase游标写法:
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
mssqlserver游标写法:
declare cursor_name cursor for select * from table
open cursor_name
fetch next cursor_name into 变量
while @@fetch_status = 0
begin
处理数据...
fetch next cursor_name into 变量
end
close cursor_name
deallocate cursor cursor_name