You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BrentOzarULTD#2887 An initial mock up for get outer command addition. Not a finished version this is just putting in place the main code less any log to table elements.
WHEN @GetOuterCommand =1THENN'event_info AS outer_command,'
663
+
ELSEN''
664
+
END+N'
611
665
derp.query_plan ,
612
666
qmg.query_cost ,
613
667
s.status ,
@@ -727,6 +781,14 @@ BEGIN
727
781
728
782
SET @StringToExecute +=
729
783
N'FROM sys.dm_exec_sessions AS s
784
+
'+
785
+
CASE
786
+
WHEN @GetOuterCommand =1THENCASE
787
+
WHENEXISTS(SELECT1FROMsys.all_objectsWHERE [name] =N'dm_exec_input_buffer') THENN'OUTER APPLY sys.dm_exec_input_buffer (s.session_id, 0) AS ib'
788
+
ELSEN'LEFT JOIN @inputbuffer ib ON s.session_id = ib.session_id'
789
+
END
790
+
ELSEN''
791
+
END+N'
730
792
LEFT JOIN sys.dm_exec_requests AS r
731
793
ON r.session_id = s.session_id
732
794
LEFT JOIN ( SELECT DISTINCT
@@ -813,6 +875,10 @@ IF @ProductVersionMajor >= 11
813
875
ELSE query_stats.statement_end_offset
814
876
END - query_stats.statement_start_offset )
815
877
/ 2 ) + 1), dest.text) AS query_text ,
878
+
'+CASE
879
+
WHEN @GetOuterCommand =1THENN'event_info AS outer_command,'
880
+
ELSEN''
881
+
END+N'
816
882
derp.query_plan ,
817
883
CAST(COALESCE(qs_live.Query_Plan, ''<?No live query plan available. To turn on live plans, see https://www.BrentOzar.com/go/liveplans ?>'') AS XML) AS live_query_plan ,
0 commit comments