📅  最后修改于: 2022-03-11 15:05:24.939000             🧑  作者: Mango
SELECT DISTINCT
StartTime
,hostname
,LoginName
,ObjectName
,CASE
WHEN EventClass = 46 THEN 'Created'
WHEN EventClass = 47 THEN 'Dropped'
WHEN EventClass = 164 THEN 'Altered'
END as EventClass
--,f.*
FROM sys.traces t
CROSS APPLY fn_trace_gettable(REVERSE(SUBSTRING(REVERSE(t.path),
CHARINDEX('\', REVERSE(t.path)),
260)
) + N'log.trc', DEFAULT) f
WHERE t.is_default = 1
AND ObjectName like 'stored_proc_name'
AND EventClass IN (46, /*Object:Created*/
47, /*Object:Dropped*/
164 /*Object:Altered*/ )
ORDER BY StartTime DESC