SQL SERVER – List Service Broker Queue Count

I have not used a service broker for quite a while and I have almost forgotten how it works. However, when paying clients of  Comprehensive Database Performance Health Check ask me questions, I try my best to help if I know the answer. Recently I was asked if I know how to List Service Broker Queue Count.

SQL SERVER - List Service Broker Queue Count queuecount-800x353

Yes it is possible to list service broker quite count and there is a very simple script for it.

SELECT ob.Name, p.Rows
FROM sys.objects o
INNER JOIN sys.partitions p ON p.object_id = o.object_id
INNER JOIN sys.objects ob ON o.parent_object_id = ob.object_id
WHERE p.index_id = 1

When you run the script above it will return the result which is very simple to the following the image where it will list the name of the queue with the queue count.

Well, that’s it for today a simple old-style blog which I used too many years ago, and I am still finding the joy in it.

SQL SERVER - List Service Broker Queue Count queuecount

Let me know if you are interested to know more about this topic. I will write more blogs as well as create an SQL in Sixty Seconds video.

Here are my few recent videos and I would like to know what is your feedback about them.

Reference: Pinal Dave (http://blog.SQLAuthority.com)

Service Broker, SQL Scripts, SQL Server
Previous Post
SQL SERVER – Enable or Disable All Triggers
Next Post
Apache2 Linux – Common Commands

Related Posts

1 Comment. Leave new

  • This is an exceptionally useful script for anyone using SQL Service Broker queues! Thanks :)


Leave a Reply