Skip to content

Instantly share code, notes, and snippets.

@gertd
Created January 17, 2017 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gertd/5ab6e1ff8eca1604e5c3d43ed075a3d1 to your computer and use it in GitHub Desktop.
Save gertd/5ab6e1ff8eca1604e5c3d43ed075a3d1 to your computer and use it in GitHub Desktop.
SQL Server Service Broker Queue Depth (number of rows enqueued)
create function dbo.GetQueueCount()
returns table
as
return
select q.name,
p.rows
from sys.objects as o
inner join sys.partitions as p
on p.object_id = o.object_id
inner join sys.objects as q
on o.parent_object_id = q.object_id
where p.index_id = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment