select * FROM sys.dm_exec_query_stats qs cross apply sys.dm_exec_sql_text(qs.sql_handle) as qtdbid Is NULL for ad hoc and prepared SQL statements.WHY?!?!?!? all queries are run against some databaseThis is really hurting me, because 98% of my QueryPlanCache is dynamic, and i want to be able to analyze which of my 38 CMS databases gets hammered by a badly designed dynamic query, which they do on a regular basis. Finding the database on wich the query is running against will allow me to find the CMS server and the delinquent code.Having the id and the plan would allso open the option to evict bad or unused queries from the plan cache, but that is a point i will raise @ teched to the SQL program managers.
Category
Proposed Solution
Benefits
Other Benefits
Please wait...