Complete a Server Assessment – Extended Event Session Information


Below you will find the code to return information about Extended Event Sessions.  Simply select the text and copy to the Clipboard.

SELECT AS ‘SessionName’
, AS ‘EventName’
, e.predicate
, AS ‘ActionName’
, AS ‘TargetName’ 
FROM sys.server_event_sessions s
INNER JOIN sys.server_event_session_events e
ON s.event_session_id = e.event_session_id
INNER JOIN sys.server_event_session_actions a
ON s.event_session_id = a.event_session_id
INNER JOIN sys.server_event_session_targets t
ON s.event_session_id = t.event_session_id
WHERE NOT IN (‘system_health’, ‘telemetry_xevents’, ‘ADS_TSQL_OnPrem’, ‘ADS_Standard_OnPrem’)

This code was written using the Microsoft SQL Server documentation.  If you find that this code was copied from else where, please let me know so I can give proper credit.