2

我可以使用服务名称进行某种查询来检索队列名称吗?

4

2 回答 2

3

sys.services

service_queue_id此服务使用的队列的对象 ID。不可为空。

因此,大致如下:

SELECT name as service_name, 
   OBJECT_SCHEMA_NAME(service_queue_id) as queue_schema_name,
   OBJECT_NAME(service_queue_id) as queue_name 
FROM sys.services
于 2013-03-14T11:50:39.947 回答
0
SELECT ServiQueue.name AS 'QueueName'
FROM sys.service_contract_message_usages AS MessageUsage
INNER JOIN sys.service_contracts AS ServiceContract ON ServiceContract.service_contract_id =MessageUsage.service_contract_id
INNER JOIN sys.service_contract_usages ServContractUse ON ServContractUse.service_contract_id =ServiceContract.service_contract_id
INNER JOIN sys.services AS Servi ON Servi.service_id=ServContractUse.service_id
INNER JOIN sys.service_queue_usages AS SerQueueUse ON SerQueueUse.service_id = Servi.service_id
INNER JOIN sys.service_queues AS ServiQueue ON ServiQueue.object_id=SerQueueUse.service_queue_id
WHERE Servi.name like 'OrderDepartment'

来源:http ://blog.extreme-advice.com/2013/02/15/find-service-broker-object-like-contract-message-type-service-name-queue-name-in-sql-server/

于 2013-03-14T11:24:08.190 回答