Skip to content

Instantly share code, notes, and snippets.

View ghotz's full-sized avatar

Gianluca Hotz ghotz

View GitHub Profile
@ghotz
ghotz / clear-broker-queue.sql
Last active July 25, 2019 20:27 — forked from jdaigle/gist:2781349
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