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 2000 Forums
 SQL Server Administration (2000)
 How many times a stored proc was run?

Author  Topic 

skyfire1
Starting Member

4 Posts

Posted - 2007-05-23 : 21:58:03
Hello all,
I was asked a question the other day and to be honest I'm drawing a blank. The question was is there a way to find out how many times a stored proc was run in a day. Does anyone have any suggestions.

Thanks

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-05-23 : 22:10:59
you could put a statement in the proc that logs to a table each time it's executed


www.elsasoft.org
Go to Top of Page

skyfire1
Starting Member

4 Posts

Posted - 2007-05-23 : 22:15:18
That was my first thought, maybe a trigger. I was just wondering if sql server kept statistics internally.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-05-23 : 22:17:06
quote:
Originally posted by skyfire1

That was my first thought, maybe a trigger. I was just wondering if sql server kept statistics internally.


It can't be a trigger. Trigger is for tables / views.


KH

Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-05-24 : 01:12:41
sql server does not keep such statistics internally afaik.


www.elsasoft.org
Go to Top of Page

DMcCallie
Yak Posting Veteran

62 Posts

Posted - 2007-05-25 : 14:17:31
SQL/DM by IDERA has that information in the Procedure Cache screen...

http://www.Idera.com
Go to Top of Page

sql_er
Constraint Violating Yak Guru

267 Posts

Posted - 2007-05-25 : 16:40:01
You could run the server side tracing the whole day, just tracing calls to that stored procedure (in case you don't have access to this stored procedure and as such cannot modify it, to log its execution)
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-05-26 : 05:23:57
"in case you don't have access to this stored procedure and as such cannot modify it"

... or rename it and "wrap" it with something that can do the counting - and then rename-back when the Stats are done.

FWIW all our Sprocs have inbuilt Timer and Counter Logging stuff for this sort of purpose.

Kristen
Go to Top of Page
   

- Advertisement -