Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete messages in service broker queue

Tags:

I'd like to clear my queue in SQL Server Management Studio, but I don't want to delete the whole queue just the content in the queue (the messages).

like image 293
senna Avatar asked May 31 '12 07:05

senna


1 Answers

Just combining the two previous answers (by Ben and Jānis) for clarity. This worked for me:

declare @c uniqueidentifier while(1=1) begin     select top 1 @c = conversation_handle from dbo.queuename     if (@@ROWCOUNT = 0)     break     end conversation @c with cleanup end 
like image 195
Rebecca Campbell Avatar answered Oct 11 '22 21:10

Rebecca Campbell