Buscar contenidos

miércoles, 24 de julio de 2019

Last time a Stored Procedure was executed


DECLARE @proc_nm sysname;

-- select the procedure name here
SET @proc_nm = 'usp_test';

SELECT s.last_execution_time
FROM sys.dm_exec_query_stats s
    CROSS APPLY sys.dm_exec_query_plan(s.plan_handle) p
WHERE OBJECT_NAME(p.objectid, DB_ID('AdventureWorks')) = @proc_nm;

No hay comentarios:

Publicar un comentario