首页 > 数据库 > SQL Server > 正文

sql server 游标fetch简单用法

2024-08-31 00:55:46
字体:
来源:转载
供稿:网友
sql server 游标fetch简单用法
//遍历tmp_check的年份和月份DECLARE @year as varchar(4)DECLARE @month as varchar(2)DECLARE cur CURSOR FOR SELECT nf,yf FROM tmp_check;OPEN cur fetch next from cur into @year,@monthwhile(@@fetch_status=0)beginPRint(@year)print(@month)//在这做其它的事fetch next from cur into @year,@monthend close cur DEALLOCATE cur

  


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表