Skip to content

Commit e0c8e78

Browse files
authored
Merge pull request BrentOzarULTD#3209 from Adedba/3163---sp_BlizWho-Querytext-not-proc-definition
sp_BlitzWho show statement text of stored procedure even when proc is executed for the first time
2 parents 5330df8 + 152129e commit e0c8e78

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

‎sp_BlitzWho.sql‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -690,11 +690,11 @@ BEGIN
690690
END AS blocking_session_id,
691691
COALESCE(DB_NAME(r.database_id), DB_NAME(blocked.dbid), ''N/A'') AS database_name,
692692
ISNULL(SUBSTRING(dest.text,
693-
( query_stats.statement_start_offset / 2 ) + 1,
694-
( ( CASE query_stats.statement_end_offset
693+
( r.statement_start_offset / 2 ) + 1,
694+
( ( CASE r.statement_end_offset
695695
WHEN -1 THEN DATALENGTH(dest.text)
696-
ELSE query_stats.statement_end_offset
697-
END - query_stats.statement_start_offset )
696+
ELSE r.statement_end_offset
697+
END - r.statement_start_offset )
698698
/ 2 ) + 1), dest.text) AS query_text ,
699699
'+CASE
700700
WHEN @GetOuterCommand = 1 THEN N'CAST(event_info AS NVARCHAR(4000)) AS outer_command,'
@@ -908,11 +908,11 @@ IF @ProductVersionMajor >= 11
908908
END AS blocking_session_id,
909909
COALESCE(DB_NAME(r.database_id), DB_NAME(blocked.dbid), ''N/A'') AS database_name,
910910
ISNULL(SUBSTRING(dest.text,
911-
( query_stats.statement_start_offset / 2 ) + 1,
912-
( ( CASE query_stats.statement_end_offset
911+
( r.statement_start_offset / 2 ) + 1,
912+
( ( CASE r.statement_end_offset
913913
WHEN -1 THEN DATALENGTH(dest.text)
914-
ELSE query_stats.statement_end_offset
915-
END - query_stats.statement_start_offset )
914+
ELSE r.statement_end_offset
915+
END - r.statement_start_offset )
916916
/ 2 ) + 1), dest.text) AS query_text ,
917917
'+CASE
918918
WHEN @GetOuterCommand = 1 THEN N'CAST(event_info AS NVARCHAR(4000)) AS outer_command,'

0 commit comments

Comments
 (0)