SQL sp_cursor_info

sp_cursor_info

use master
go
create proc sp_cursor_info
(@scope int = 3)
as
-- Declare a cursor variable to hold the cursor output variable
-- from sp_cursor_list.

DECLARE @Report CURSOR
-- Execute sp_cursor_list into the cursor variable.

EXEC master.dbo.sp_cursor_list @cursor_return = @Report OUTPUT,

@cursor_scope = @scope
  
-- Fetch all the rows from the sp_cursor_list output cursor.
WHILE (@@FETCH_STATUS = 0)
BEGIN
    FETCH NEXT from @Report
END
  
-- Close and deallocate the cursor from sp_cursor_list.
CLOSE @Report
DEALLOCATE @Report
RETURN
GO