June 2, 2010 at 12:01 pm
Hi folks,
I am just wondering if there is a way to track the usage of stored procedures and functions in SQL 2005? I want to know how many times an sp or fn was executed and by who?
Another question is how do I know the last modified date of each object?
Thanks.
June 2, 2010 at 12:09 pm
halifaxdal (6/2/2010)
Hi folks,I am just wondering if there is a way to track the usage of stored procedures and functions in SQL 2005? I want to know how many times an sp or fn was executed and by who?
Another question is how do I know the last modified date of each object?
Thanks.
to track usage, I think you'll need to add a server side DML trace, which you can then query over time to check for usage; iusage or counts of usage are not part of the "default" trace.
to check on created/modified, the view sys.objects ahs what you need:
select name,create_date,modify_date from sys.objects WHERE type_desc in
('SQL_STORED_PROCEDURE',
'AGGREGATE_FUNCTION',
'SQL_INLINE_TABLE_VALUED_FUNCTION',
'SQL_TABLE_VALUED_FUNCTION',
'SQL_SCALAR_FUNCTION')
Lowell
June 2, 2010 at 12:17 pm
Thank you.
to check on created/modified, the view sys.objects ahs what you need:
select name,create_date,modify_date from sys.objects WHERE type_desc in
('SQL_STORED_PROCEDURE',
'AGGREGATE_FUNCTION',
'SQL_INLINE_TABLE_VALUED_FUNCTION',
'SQL_TABLE_VALUED_FUNCTION',
'SQL_SCALAR_FUNCTION')
June 2, 2010 at 1:13 pm
One thing missing here: is it possible to find out the last modified user? who made the last change? It seems not included in the sys.objects table. I do see a priciple_id in sys.objects however all are NULL in my result, I am not sure if that represents the user who did the last update to the object.
June 2, 2010 at 2:43 pm
halifaxdal (6/2/2010)
One thing missing here: is it possible to find out the last modified user? who made the last change? It seems not included in the sys.objects table. I do see a priciple_id in sys.objects however all are NULL in my result, I am not sure if that represents the user who did the last update to the object.
if not too much time has elapsed, the default trace might have the info for last created/modified...but it can roll over and overwrite on a server with a lot of DDL stuff going on.
easiest way is to use the built in GUI report, which auto filters on the selected db:
Lowell
June 2, 2010 at 8:05 pm
thank you Lowell
Where can I find the report file (.rdl?)? maybe from the report file I can find some clue on how the report is generated and create my own customized report.
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply