Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT TOP 1 TraceFile.[value]
- FROM sys.fn_trace_getinfo(NULL) TraceFile
- WHERE TraceFile.property = 2
- ---------------------------------------------------------
- SELECT TraceEvent.name AS [EventName],
- Trace.DatabaseName,
- Trace.DatabaseID,
- Trace.NTDomainName,
- Trace.ApplicationName,
- Trace.LoginName,
- Trace.SPID,
- Trace.Duration,
- Trace.StartTime,
- Trace.EndTime
- FROM sys.fn_trace_gettable(CONVERT(VARCHAR(150), (SELECT TOP 1 TraceFile.[value]
- FROM sys.fn_trace_getinfo(NULL) TraceFile
- WHERE TraceFile.property = 2
- )), 4) Trace
- JOIN sys.trace_events TraceEvent ON Trace.EventClass = TraceEvent.trace_event_id
- WHERE TraceEvent.name LIKE 'Audit Addlogin Event'
- ORDER BY Trace.StartTime;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement