Getting “Transaction was deadlocked” errors randomly? Deadlocks happen when two transactions lock resources in opposite order. Here’s how to fix them permanently. Identify Deadlocks – System Health Session: — SQL Server automatically logs deadlocks to system_health session SELECT CAST(target_data AS XML) AS deadlock_xml FROM sys.dm_xe_session_targets st JOIN sys.dm_xe_sessions s ON s.address = st.event_session_address WHERE s.name […]
