April 17, 2012

sp_cursor_list (Transact-SQL MetaData) Definition

Please note: that the following source code is provided and copyrighted by Microsoft and is for educational purpose only.
The meta data is from an SQL 2012 Server.

I have posted alot more, find the whole list here.

Goto Definition or MetaData

Definition:

sys.sp_cursor_list(int @cursor_scope)

MetaData:

 --  Creation of sp_cursor_list  

create procedure sys.sp_cursor_list
(
@cursor_return CURSOR VARYING OUTPUT,
@cursor_scope int
)
AS

if (@cursor_scope < 1) OR (@cursor_scope > 3)
begin
-- Raise an error: ?The value of parameter is invalid? --
raiserror ( 16902, 1, 1,N'sys.sp_cursor_list', N'@cursor_scope')
return (1)
end

if ( @cursor_scope < 3)
begin
set @cursor_return = CURSOR LOCAL SCROLL DYNAMIC FOR
SELECT reference_name, cursor_name, cursor_scope,
status, model, concurrency, scrollable,
open_status, cursor_rows, fetch_status,
column_count, row_count, last_operation,
cursor_handle
FROM sys.syscursorrefs scr, sys.syscursors sc
WHERE scr.cursor_scope = @cursor_scope AND
scr.cursor_handl = sc.cursor_handle
ORDER BY cursor_handle
FOR READ ONLY
end
else
begin
set @cursor_return = CURSOR LOCAL SCROLL DYNAMIC FOR
SELECT reference_name, cursor_name, cursor_scope,
status, model, concurrency, scrollable,
open_status, cursor_rows, fetch_status,
column_count, row_count, last_operation,
cursor_handle
FROM sys.syscursorrefs scr, sys.syscursors sc
WHERE scr.cursor_handl = sc.cursor_handle
ORDER BY cursor_handle
FOR READ ONLY
end
open @cursor_return

No comments:

Post a Comment

Total Pageviews