H
I am currently re-writing an overnight index defrag procedure and would like to audit indexes in my database - logging the before defrag action" avg fragmentation value and "after defrag action" frag value in an audit table. This will be for all databases on the server. I have completed the vast majority of it (cycling though all the databases, detecting which indexes need reorganising or rebuilding and inserting the information into a table) but I cannot get the audit values working properly. For example, a sample row in my audit table would look like this:
ID Name DB Table frag_before frag_after 1 Index2 DB1 Table6 70.33456 0.03 2 Index7 DB1 Table9 45.98 1.2567
etc
Any idea on how to accomplish this? Some sample code would be useful.
Thanks in advance.
- Edited by warnerrj79 9 hours 11 minutes ago