mercredi 11 mai 2016

Invalid object name 'sys.dm_exec_procedure_stats' error

I am trying to obtain the maximum time consumed by a stored procedure in my DB. I obtained a sample query from here to obtain the same using sys.dm_exec_procedure_stats. The same is posted below. Whenever I try to execute this query I get the error as

Msg 208, Level 16, State 1, Line 1 Invalid object name 'sys.dm_exec_procedure_stats'.

Can you please let me know where I might probably be going wrong?

Below is the query used. No changes made.

SELECT TOP 10 d.object_id, d.database_id, OBJECT_NAME(object_id, database_id) 'proc name',
       d.cached_time, d.last_execution_time, d.total_elapsed_time,
       d.total_elapsed_time/d.execution_count AS [avg_elapsed_time],
       d.last_elapsed_time, d.execution_count
FROM sys.dm_exec_procedure_stats AS d
ORDER BY [total_worker_time] DESC;

EDIT: Sorry for the blunder. Server is 2005.

Aucun commentaire:

Enregistrer un commentaire