Created
November 23, 2017 18:09
-
-
Save ghotz/812eb97f544f3dc41b4da234b37bbcad to your computer and use it in GitHub Desktop.
Call sp_whoisactive filtering broker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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