Skip to content

Commit 797b6ca

Browse files
committed
Filters out background sessions
We shouldn't show these with sleeping SPIDs
1 parent 26ae3c9 commit 797b6ca

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

sp_BlitzWho.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ SET @StringToExecute = N'
198198
OUTER APPLY [sys].[dm_exec_sql_text]([r].[sql_handle]) AS [dest]
199199
OUTER APPLY [sys].[dm_exec_query_plan]([r].[plan_handle]) AS [derp]
200200
WHERE [r].[session_id] <> @@SPID
201+
AND [s].[host_name] IS NOT NULL
201202
AND (([s].[status] <> ''sleeping'' AND ' + CONVERT(NVARCHAR(1), @ShowSleepingSPIDs) + ' = 0) OR ' + CONVERT(NVARCHAR(1), @ShowSleepingSPIDs) + ' = 1)
202203
ORDER BY 2 DESC;
203204
'
@@ -328,6 +329,7 @@ SELECT @StringToExecute = N'
328329
OUTER APPLY [sys].[dm_exec_sql_text]([r].[sql_handle]) AS [dest]
329330
OUTER APPLY [sys].[dm_exec_query_plan]([r].[plan_handle]) AS [derp]
330331
WHERE [r].[session_id] <> @@SPID
332+
AND [s].[host_name] IS NOT NULL
331333
AND (([s].[status] <> ''sleeping'' AND ' + CONVERT(NVARCHAR(1), @ShowSleepingSPIDs) + ' = 0) OR ' + CONVERT(NVARCHAR(1), @ShowSleepingSPIDs) + ' = 1)
332334
ORDER BY 2 DESC;
333335
'

0 commit comments

Comments
 (0)