[英]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.