System Table Audit Script

Something like this may already be out there in the world, but I didn't find it when I looked.

After a trouble ticket last week was traced back to a System Table change made by a user, I wanted an easy way to see what values had changed in all system tables within a date range.

After a little monkeying around and a trip back to Dynamic SQL school, I came up with something that gives me exactly that.

The script parses T_REFERENCE_TABLES.  Anything it finds that has a 'last_updated_dt' column registered gets polled and added to the result.

What I end up with is a table with the System Table name, the record ID and the audit information.  Not perfect yet but it will give me a quick way to see if someone has been messing around in an area that is suddenly having troubles.

I've attached the script to my profile if anyone is interested.