Created
May 24, 2012 12:39
-
-
Save jdaigle/2781349 to your computer and use it in GitHub Desktop.
SQL Server Service Broker: Short Script to clear empty a named queue
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 @handle UNIQUEIDENTIFIER; | |
WHILE (SELECT COUNT(*) FROM NameOfQueue) > 0 | |
BEGIN | |
RECEIVE TOP (1) @handle = conversation_handle FROM NameOfQueue; | |
END CONVERSATION @handle WITH CLEANUP | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment