select e.name as eventclass,t.loginname, t.spid, t.starttime, t.textdata, t.objectid, t.objectname, t.databasename, t.hostname, t.ntusername, t.ntdomainname, t.clientprocessid, t.applicationname, t.error FROM sys.fn_trace_gettable(CONVERT(VARCHAR(150), ( SELECT TOP 1 f.[value] FROM sys.fn_trace_getinfo(NULL) f --找到日志表 WHERE f.property = 2 )), DEFAULT) T inner join sys.trace_events e on t.eventclass = e.trace_event_id where eventclass IN(47,164) --47:OBJECT DELETE, 163 OBJECT ALTER --returns full list of events SELECT * FROM sys.trace_events --returns a full list of categories SELECT * FROM sys.trace_categories --returns a full list of subclass values SELECT *FROM sys.trace_subclass_values SELECT TOP 50 * FROM sys.fn_trace_getinfo(NULL)