Follow sqlserver-dba.com

Subscribe to RSS feed  Follow @jackvamvas - Twitter

*Use the Comments section for questions

SQLServer-DBA.com Links

Dba_db2_button

dba-ninja.com

SQL Server DBA Jobs

SQL Server - Last time a stored procedure was executed

27 December,2010 by Tom Collins

"Is there any way that I can tell when a stored procedure was last executed or who executed it? Is there any execution history that I can look at?"

 The following query will assist in telling you what time a stored procedure was last executed – assuming the query hasn’t been flushed from the cache.

 

SELECT object_name(m.object_id), MAX(qs.last_execution_time)

  FROM   sys.sql_modules m

  LEFT   JOIN (sys.dm_exec_query_stats qs

               CROSS APPLY sys.dm_exec_sql_text (qs.sql_handle) st)

         ON m.object_id = st.objectid

        AND st.dbid = db_id()

  GROUP  BY object_name(m.object_id);


 Read More

SQL Server - Who made DDL table changes on the database. - SQL

How to create a SQL Server Security Audit - SQL Server DBA

SQL Server - Database Server Security Audit Process - SQL Server ...


Author: Tom Collins (http://www.sqlserver-dba.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on SQL Server - Last time a stored procedure was executed


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer