dbTalk Databases Forums  

stored procedure stats

microsoft.public.sqlserver.tools microsoft.public.sqlserver.tools


Discuss stored procedure stats in the microsoft.public.sqlserver.tools forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Rayne Bair
 
Posts: n/a

Default stored procedure stats - 08-19-2003 , 05:22 PM






Is there any way to see when a stored procedure was last called or run? I'd like to clean up a database that was set up before I took over and I need to see which sp haven't been called in a while. Also, if it is possible, is this info stored in the master or in a system table in the db that the sp resides in?

Thanks,
Rayne Bair

--
Want to know what I read?
http://raynebair.bookcrossing.com




Reply With Quote
  #2  
Old   
Greg Obleshchuk
 
Posts: n/a

Default Re: stored procedure stats - 08-19-2003 , 07:34 PM






Rayne,
You are out of luck here. This type of information is not tracked by SQL. You could add a simple insert statement to the start of each SP that inserts a record into a simple table. Like


CREATE TABLE [dbo].[Track_SP] (
[SP_Name] [varchar] (128) NOT NULL ,
[CallDate] [datetime] NOT NULL
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[Track_SP] ADD
CONSTRAINT [DF_Track_SP_CallDate] DEFAULT (getdate()) FOR [CallDate]
GO


-- Start Insert at start of SP
INSERT INTO Track_SP(SP_Name) VALUES ('MYSPNAme')
-- End Insert at start of SP


After about a month this would give you a good idea.


--
I hope this helps
regards
Greg O MCSD
http://www.ag-software.com/ags_scribe_index.asp. SQL Scribe Documentation Builder, the quickest way to document your database
http://www.ag-software.com/ags_SSEPE_index.asp. AGS SQL Server Extended Property Extended properties manager for SQL 2000
http://www.ag-software.com/IconExtractionProgram.asp. Free icon extraction program
http://www.ag-software.com. Free programming tools

"Rayne Bair" <themrs (AT) wifetalks (DOT) com> wrote

Is there any way to see when a stored procedure was last called or run? I'd like to clean up a database that was set up before I took over and I need to see which sp haven't been called in a while. Also, if it is possible, is this info stored in the master or in a system table in the db that the sp resides in?

Thanks,
Rayne Bair

--
Want to know what I read?
http://raynebair.bookcrossing.com




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.