繁体   English   中英

使用Query查找在SQL Server中使用游标的所有存储过程

[英]Find all the stored Procedures that use a cursor in SQL Server using Query

是否可以列出使用SQL查询在SQL Server中使用游标的所有存储过程。 请建议我。

 select * from sys.sql_modules where definition like '%CURSOR FOR %'

如果您要查找当前打开的游标,可以使用此查询:

SELECT creation_time, cursor_id, name, c.session_id, login_name   
FROM sys.dm_exec_cursors(0) AS c   
JOIN sys.dm_exec_sessions AS s ON c.session_id = s.session_id  

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM