Skip to content

Commit

Permalink
add sql handles to output
Browse files Browse the repository at this point in the history
  • Loading branch information
erikdarlingdata committed Nov 6, 2022
1 parent 446c7ba commit 85815f8
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
26 changes: 25 additions & 1 deletion sp_HumanEvents/sp_HumanEvents.sql
Expand Up @@ -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,
Expand Down Expand Up @@ -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.*
Expand Down
26 changes: 25 additions & 1 deletion sp_HumanEvents/sp_HumanEventsBlockViewer.sql
Expand Up @@ -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,
Expand Down Expand Up @@ -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.*
Expand Down

0 comments on commit 85815f8

Please sign in to comment.