• very nice post. i was trying to write something similar to yours but was stuck on how to get the archived trace file locations.

    I have few suggestions. i don't think this part is correct

    INNER JOIN sys.trace_subclass_values sv

    ON tr.eventclass = sv.trace_event_id

    -- i think we have to use tr.EventSubClass instead of tr.objectType

    AND tr.ObjectType = sv.subclass_value

    -- can not join like this, objects can be from any database and sys.objects is local to each database

    LEFT JOIN sys.objects o

    ON tr.ObjectID = o.OBJECT_ID

    -- to overcome the last problem. I created a temp table that has dbname,objectname,objectid and populated this table with all objects from all databases. then joined on dbname and objectid to get objectname