Created
November 13, 2019 18:42
-
-
Save james-s-tayler/a0ba7229ca6ac83abeda7a6de2d57d4a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT XEvent.query('(event/data/value/deadlock)[1]') AS DeadlockGraph | |
FROM ( | |
SELECT XEvent.query('.') AS XEvent | |
FROM ( | |
SELECT CAST(target_data AS XML) AS TargetData | |
FROM sys.dm_xe_session_targets st | |
INNER JOIN sys.dm_xe_sessions s ON s.address = st.event_session_address | |
WHERE s.NAME = 'system_health' | |
AND st.target_name = 'ring_buffer' | |
) AS Data | |
CROSS APPLY TargetData.nodes('RingBufferTarget/event[@name="xml_deadlock_report"]') AS XEventData(XEvent) | |
) AS source; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment