Last Access Date Time of Stored Procedure and Functions.

  • There is no way to know this unless your have started the trace.

    Regards,
    Nitin

  • As long as the plan is still loaded into the proc cache, you can somewhat use the DMV's for this. If it wasn't run since the last cache flush or restart of SQL Server, you have lost it and won't be able to tell at all, even with a SQL Trace:

    select db_name(eqp.dbid) as [DBName],

    object_name(eqp.objectid, dbid) as [ProcedureName],

    eqs.last_execution_time

    from sys.dm_exec_cached_plans ecp

    join sys.dm_exec_query_stats eqs on ecp.plan_handle = eqs.plan_handle

    cross apply sys.dm_exec_query_plan(ecp.plan_handle) eqp

    where objtype = N'Proc'

    Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
    My Blog | Twitter | MVP Profile
    Training | Consulting | Become a SQLskills Insider
    Troubleshooting SQL Server: A Guide for Accidental DBAs[/url]

Viewing 2 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply