????????????SQL SERVER???α????????e??????????SQL Server??????α?????????λ????????μ???????????????????α??????е?????????????????£????????????
??????1??????????????ó????????????α?????????????α?
????DECLARE Cursor_Test CURSOR FOR
????SELECT * FROM dbo.TEST;
????OPEN Cursor_Test;
????????????????μ???????????????????α????SQL SERVER??????????????????sys.dm_exec_cursors?????????й????????????д????α???????
????SELECT * FROM sys.dm_exec_cursors(0)
??????????????????????????????ε?????????ο?MSDN???????????????????????????????й????α???????????is_open???й????????α???????????1?????0???????
??????2??????й????α?
SELECT  session_id ??
cursor_id ??
name ??
creation_time ??
is_open
FROM    sys.dm_exec_cursors(0)
WHERE   is_open = 1;
clipboard

?????????????????????????????α????????1??й???α?????CLOSE Cursor_Test;?????????α??????????

??????????????????SQL??????????????????????1 С??????α?????????????????е????????????
SELECT   creation_time
??cursor_id
??name
??c.session_id
??login_name
??c.creation_time
??c.is_open
FROM    sys.dm_exec_cursors (0) AS c
JOIN sys.dm_exec_sessions AS s ON c.session_id = s.session_id
WHERE   DATEDIFF(hh?? c.creation_time?? GETDATE()) > 1;
GO