sqlserver 游标的使用
发布时间:2016-01-29 15:00:08
declare @temp_temp uniqueidentifier--临时变量 DECLARE aaa CURSOR for select Id from A-------------------打开游标open aaa--先查询一次再循环,防止有多个游标时@@FETCH_ ...
declare @temp_temp uniqueidentifier--临时变量 DECLARE aaa CURSOR for select Id from A-------------------打开游标open aaa--先查询一次再循环,防止有多个游标时@@FETCH_STATUS=-1不能进入下个游标循环的情况fetch next from aaa into @temp_temp-------------------循环取数据while @@FETCH_STATUS=0beginprint @temp_tempfetch next from aaa into @temp_tempend----------------------------------- 关闭游标 Close aaa ----------------------------------- 删除游标 Deallocate aaa
原标题:sqlserver 游标的使用
关键词:sql
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。