On 30 Nov 2004 18:45:55 -0800, Viswanatha Thalakola wrote:
Hello,
Can someone point me to getting the total number of inserts and updates on a table
over a period of time?
I just want to measure the insert and update activity on the tables.
Thanks.
- Vish
Hi Vish,
The easiest way to do this is to add some counting logic to the stored
procedures that do the inserting, updating and deleting. But if you can't
or won't change those tables (or if you allow direct data modifications,
without using stored procedures), you have two other options:
1. Set up a profiler trace. Catch the trace results in a table or in a
file, then use either SQL queries (if in a table) or text manipulation
tools (if in a file) to count the number of inserts, updates, etc. I must
add that I don't know the exact format and I'm not sure either if the
number of rows affected is included in the trace data (it it isn't, you
can't use this approach).
2. Create triggers for each table you need to monitor. Have these triggers
copy @@rowcount in a local variable as the first statement (that yields
the number of rows affected by the statement that fired the trigger) and
save that value to a table.
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)