Can someone explain this code line by line? I would like to understand the purpose and effect of each line this code has. This code is from Microsoft and doesn't have the best description of what is going on. I plan to use this code and would like to know where the generic names are as well vs the syntactically correct code. THANKS!!
From Microsoft, looked at their documentation but can't find everything
enter code here
USE DATABASE;
GO
SELECT *
FROM fn_trace_gettable
(drive, default);
GO
SELECT
TE.name AS [DLL_EDIT],
TT.DatabaseName,
TT.DatabaseID,
TT.ApplicationName,
TT.LoginName,
TT.Duration,
TT.Duration,
TT.StartTime,
TT.EndTime
FROM sys.fn_trace_gettable(
CONVERT (VARCHAR(4000),
(
SELECT TOP 1
f.[value]
FROM sys.fn_trace_gettable(NULL) f
WHERE f.property = 2
)), DEFAULT
) TT
JOIN
sys.trace_events TE
ON TT.EventsClass = TE.trace_events_id
ORDER BY TT.StartTime desc;
))
)