Skip to content

Instantly share code, notes, and snippets.

@jdaigle
Created May 24, 2012 12:38
Show Gist options
  • Save jdaigle/2781344 to your computer and use it in GitHub Desktop.
Save jdaigle/2781344 to your computer and use it in GitHub Desktop.
SQL Server Service Broker: Short Script to clear DISCONNECTED_INBOUND conversations
DECLARE @handle UNIQUEIDENTIFIER;
WHILE (SELECT COUNT(*) from sys.conversation_endpoints (nolock) where state_desc = 'DISCONNECTED_INBOUND') > 0
BEGIN
SELECT TOP 1 @handle = conversation_handle from sys.conversation_endpoints (nolock) where state_desc = 'DISCONNECTED_INBOUND';
END CONVERSATION @handle WITH CLEANUP
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment