This SQL query is designed for BizTalk version 2006 - 2010. It is created to gather inforamtion from the DTA database to locate orphaned messages. It will provide you with information from the service that creates the orphan message so it can be resolved.

This script can also be rewritten and the * at the first select can be set with a count(*) instead to get the amount of messages instead of the entire row and data of them. This is recommended if you have many of them.