1

Like below query, is there any query which can return the execution status of a function in SQL server using sys.dm_exec_?

SELECT TOP 1 
    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)/1000 AS [avg_elapsed_time],
    d.last_elapsed_time/1000 as last_elapsed_time,
    d.execution_count,
    *
FROM 
    sys.dm_exec_procedure_stats AS d 
WHERE 
    OBJECT_NAME(object_id, database_id) = 'ssp_StoredProcedureName'
ORDER BY 
    d.Last_Execution_Time DESC

1 Answer 1

1

You can't get exact function execution stats in versions below SQL2016.But from SQLSERVER 2016,we have sys.dm_exec_function_stats.

Applies to: SQL Server (SQL Server 2016 Community Technology Preview
3.2 (CTP 3.2) through current version), Azure SQL Database, Azure SQL Data Warehouse Public Preview.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.