标签:pen fetch end from oca print 释放 调用 status
--声明一个游标 DECLARE MyCursor CURSOR FOR --打开一个游标 OPEN MyCursor --将游标读取到的值赋给变量,以供循环里面调用 DECLARE @Customerid varchar(100) FETCH NEXT FROM MyCursor INTO @Customerid WHILE @@FETCH_STATUS =0 BEGIN PRINT @Customerid FETCH NEXT FROM MyCursor INTO @Customerid END --关闭游标 CLOSE MyCursor --释放资源 DEALLOCATE MyCursor
sql server游标使用模板。
标签:pen fetch end from oca print 释放 调用 status
原文地址:https://www.cnblogs.com/icyJ/p/CURSOR_USE.html