Skip to content

Instantly share code, notes, and snippets.

@ghotz
Created November 23, 2017 18:09
Show Gist options
  • Select an option

  • Save ghotz/812eb97f544f3dc41b4da234b37bbcad to your computer and use it in GitHub Desktop.

Select an option

Save ghotz/812eb97f544f3dc41b4da234b37bbcad to your computer and use it in GitHub Desktop.
Call sp_whoisactive filtering broker
DECLARE @schema VARCHAR(MAX)
EXEC sp_whoisactive @return_schema = 1, @schema = @schema OUTPUT
SET @schema = 'IF object_id(''tempdb..##tmp'') IS NOT NULL DROP TABLE ##tmp; ' + REPLACE(@schema, '<table_name>', '##tmp')
EXEC (@schema)
EXEC sp_whoisactive @destination_table = '##tmp'
SELECT *
FROM ##tmp
WHERE wait_info NOT LIKE '%BROKER_RECEIVE_WAITFOR%'
OR wait_info IS NULL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment