Skip to content

Instantly share code, notes, and snippets.

@jdaigle
Created May 24, 2012 12:39
Show Gist options
  • Save jdaigle/2781349 to your computer and use it in GitHub Desktop.
Save jdaigle/2781349 to your computer and use it in GitHub Desktop.
SQL Server Service Broker: Short Script to clear empty a named queue
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