cursor
I have a stored procedure..something like this:
DECLARE @AuthorID char(11)
DECLARE c1 CURSOR FOR
SELECT au_id
FROM authors
OPEN c1
FETCH NEXT FROM c1
INTO @AuthorID
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT @AuthorID
FETCH NEXT FROM c1
INTO @AuthorID
END
CLOSE c1
DEALLOCATE c1
SET CURSOR_CLOSE_ON_COMMIT ON
SET CURSOR_CLOSE_ON_COMMIT OFF
DECLARE @AuthorIDs char(11)
DECLARE c11 CURSOR FOR
SELECT au_id
FROM authors
OPEN c11
FETCH NEXT FROM c11
INTO @AuthorIDs
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT @AuthorIDs
FETCH NEXT FROM c11
INTO @AuthorIDs
END
CLOSE c11
DEALLOCATE c11
SET CURSOR_CLOSE_ON_COMMIT ON
DECLARE @AuthorIDw char(11)
SET CURSOR_CLOSE_ON_COMMIT OFF
DECLARE c12 CURSOR FOR
SELECT au_id
FROM authors
OPEN c12
FETCH NEXT FROM c12
INTO @AuthorIDw
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT @AuthorIDw
FETCH NEXT FROM c12
INTO @AuthorIDw
END
CLOSE c12
DEALLOCATE c12
GOTO DOWNLOAD_REPORT
DOWNLOAD_REPORT:
print 'End report'
RETURN
question: if my second cursor doesnt contains any values, do 3rd cursor and GOTO still be executing?
|