diff --git a/sp_HumanEvents/sp_HumanEvents.sql b/sp_HumanEvents/sp_HumanEvents.sql index 02a8baa..f725974 100644 --- a/sp_HumanEvents/sp_HumanEvents.sql +++ b/sp_HumanEvents/sp_HumanEvents.sql @@ -2781,6 +2781,7 @@ BEGIN kheb.wait_time, kheb.status, kheb.isolation_level, + c.sql_handles, kheb.resource_owner_type, kheb.lock_mode, kheb.transaction_count, @@ -2850,7 +2851,30 @@ BEGIN bd.database_id ) FROM #blocked AS bd - ) AS kheb; + ) AS kheb + CROSS APPLY + ( + SELECT + sql_handles = + STUFF + ( + ( + SELECT DISTINCT + ',' + + RTRIM + ( + n.c.value('@sqlhandle', 'varchar(130)') + ) + FROM kheb.blocked_process_report.nodes('//executionStack/frame') AS n(c) + FOR XML + PATH(''), + TYPE + ).value('./text()[1]', 'varchar(max)'), + 1, + 1, + '' + ) + ) AS c; SELECT b.* diff --git a/sp_HumanEvents/sp_HumanEventsBlockViewer.sql b/sp_HumanEvents/sp_HumanEventsBlockViewer.sql index ad613e4..036c69b 100644 --- a/sp_HumanEvents/sp_HumanEventsBlockViewer.sql +++ b/sp_HumanEvents/sp_HumanEventsBlockViewer.sql @@ -523,6 +523,7 @@ END; kheb.wait_time, kheb.status, kheb.isolation_level, + c.sql_handles, kheb.resource_owner_type, kheb.lock_mode, kheb.transaction_count, @@ -592,7 +593,30 @@ END; bd.database_id ) FROM #blocked AS bd - ) AS kheb; + ) AS kheb + CROSS APPLY + ( + SELECT + sql_handles = + STUFF + ( + ( + SELECT DISTINCT + ',' + + RTRIM + ( + n.c.value('@sqlhandle', 'varchar(130)') + ) + FROM kheb.blocked_process_report.nodes('//executionStack/frame') AS n(c) + FOR XML + PATH(''), + TYPE + ).value('./text()[1]', 'varchar(max)'), + 1, + 1, + '' + ) + ) AS c; SELECT b.*