declare cur cursor for select conversation_handle from sys.transmission_queue open cur; fetch next from cur into @handle; while @@fetch_status = 0 begin --print @handle end conversation @handle with cleanup; fetch next from cur into @handle end close cur; deallocate cur;