1
2 /* Sccsid = "%Z% generic/sproc/%M% %I% %G%" */
3
4 create procedure sp_cursorinfo
5 @cursor_level int = null, /* nesting level for cursor */
6 @cursor_name varchar(30) = null /* cursor name */
7 as
8
9 if @@trancount = 0
10 begin
11 set chained off
12 end
13 set transaction isolation level 1
14
15 /* set cursor level to -1 to get cursor info for all nesting levels */
16 if @cursor_level is null
17 select @cursor_level = - 1
18
19 /* Do the work */
20 dbcc cursorinfo(@cursor_level, @cursor_name)
21
22 return (0)
23
24
exec sp_procxmode 'sp_cursorinfo', 'AnyMode'
go
Grant Execute on sp_cursorinfo to public
go