2个回答
展开全部
declare @gmurl varchar(50),@qq varchar(50)
declare Cursor_1 Cursor for select gmurl,qq from gm
open Cursor_1
fetch next from Cursor_1 into @gmurl,@qq
while @@fetch_status=0
begin
print @gmurl+@qq
fetch next from Cursor_1 into @gmurl,@qq
end
close Cursor_1
Deallocate cursor_1
declare Cursor_1 Cursor for select gmurl,qq from gm
open Cursor_1
fetch next from Cursor_1 into @gmurl,@qq
while @@fetch_status=0
begin
print @gmurl+@qq
fetch next from Cursor_1 into @gmurl,@qq
end
close Cursor_1
Deallocate cursor_1
展开全部
SQL Server 游标这样用
DECLARE @N INT,@M INT
SELECT @N=5,@M=10
DECLARE Cur1 SCROLL CURSOR FOR
SELECT * FROM sysobjects
OPEN Cur1
FETCH ABSOLUTE 5 FROM Cur1
DECLARE @i INT
SET @i=1
WHILE @@FETCH_STATUS=0
BEGIN
SET @i=@i+1
IF @i<=@M-@N+1
FETCH NEXT FROM Cur1
ELSE
GOTO Roy
END
Roy:
CLOSE Cur1
DEALLOCATE Cur1
DECLARE @N INT,@M INT
SELECT @N=5,@M=10
DECLARE Cur1 SCROLL CURSOR FOR
SELECT * FROM sysobjects
OPEN Cur1
FETCH ABSOLUTE 5 FROM Cur1
DECLARE @i INT
SET @i=1
WHILE @@FETCH_STATUS=0
BEGIN
SET @i=@i+1
IF @i<=@M-@N+1
FETCH NEXT FROM Cur1
ELSE
GOTO Roy
END
Roy:
CLOSE Cur1
DEALLOCATE Cur1
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询