SQL serve 游标记录数据条数
作者:互联网
这个很好办,你在你的游标循环中加一个变量纪录滚过的纪录即可
如:
declare @cur_pos int
declare mycursor cursor for select col1,col2 from mytable
declare @col1 char(10)
declare @col2 char(10)
open mycusor
fetch next mycursor into @col1,@col2
while @@fetch_status<>-1
begin
.....
--您的处理
select @cur_pos=@cur_pos+1
fetch next mycursor into @col1,@col2
end
declare @cur_pos int
declare mycursor cursor for select col1,col2 from mytable
declare @col1 char(10)
declare @col2 char(10)
open mycusor
select @cur_pos=@cur_pos+1
fetch next mycursor into @col1,@col2
while @@fetch_status<>-1
begin
标签:cur,serve,col2,游标,col1,mycursor,条数,pos,declare 来源: https://www.cnblogs.com/1241187306qq/p/16528323.html