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

本文对比了Sybase和MSSQL中游标的使用方法,详细介绍了两种数据库系统下游标的声明、打开、获取数据及关闭的全过程。
1528

被折叠的 条评论
为什么被折叠?



