Audit Procedures used on SQL Server DB -


i've inherited database contains thousands of stored procedures , functions, of them deprecated , no longer in use.

i've started adding piece of code stored procedures 1 @ time notify me if run, process quite manual.

is there way start audit, , see stored procedures run in next month or 2 without adding piece of code each stored procedure manually?

thanks, eric

i believe need on sql server 2005 sp2 or higher. in prior versions of sql server, object_name function accepts parameter object_id.

hopefully should work you:

select db_name(dest.[dbid]) 'databasename'     , object_name(dest.objectid) 'procname'     , max(deqs.last_execution_time) 'last_execution' sys.dm_exec_query_stats deqs cross apply sys.dm_exec_sql_text(deqs.sql_handle) dest dest.[text] '%yourtablename%' -- replace     , dest.[dbid] = db_id()  -- exclude ad-hocs group db_name(dest.[dbid])     , object_name(dest.objectid) order databasename     , procname option (maxdop 1); 

Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -