SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

The Shadow Knows What Procedures Lurk in the SQL Plan Cache

How do you know what procedures are cached in SQL Server? Simple, just ask, and SQL Server will tell you.You can query the SQL Server dynamic management views to get a list of procedures in cache. In this example, I query sys.dm_exec_cached_plans and sys.dm_exec_sql_text:

Select object_name(st.objectid, st.dbid) As ProcedureName
From sys.dm_exec_cached_plans cp
Cross Apply sys.dm_exec_sql_text(cp.plan_handle) st
Where cp.objtype = 'Proc'
And st.dbid = db_id();



No comments.

Leave a Comment

Please register or log in to leave a comment.