Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Last used procedures.

Author  Topic 

kumarich1
Yak Posting Veteran

99 Posts

Posted - 2009-09-16 : 11:02:37
Hi,

In sql server 2005, I am trying to get list of last used stored procedures. Can anyone please suggest how I can get this.

Thanks

YellowBug
Aged Yak Warrior

616 Posts

Posted - 2009-09-16 : 11:28:34
Query the DMVs:

select type_desc
, last_execution_time
, [text]
FROM sys.dm_exec_procedure_stats sp
outer apply sys.dm_exec_sql_text (sp.plan_handle) as sql_text
ORDER BY last_execution_time desc
Go to Top of Page

kumarich1
Yak Posting Veteran

99 Posts

Posted - 2009-09-16 : 11:55:37
We are still in sql 2005 version.I think this DMV is in SQL 2008 version.Please advice how can I do this in sql 2005.
Go to Top of Page

YellowBug
Aged Yak Warrior

616 Posts

Posted - 2009-09-16 : 12:44:10
Sorry. I don't have SQL 2005 right now.
Change sys.dm_exec_procedure_stats to sys.dm_exec_query_stats

Also have a look at this link: http://bytes.com/topic/sql-server/answers/761908-removing-unused-objects-sql-server-2000-2005-a
Go to Top of Page
   

- Advertisement -