Search This Blog

Wednesday, February 10, 2010

How to find the object dependencies using SQL Query

Below is the sql query to find dependencies of a table(ListingHdr).

SELECT TableName, DependentObject
FROM (
              SELECT DISTINCT
                  o.Name 'TableName',
                   op.Name 'DependentObject'
              FROM SysObjects o
               INNER Join SysDepends d ON d.DepId = o.Id
               INNER Join SysObjects op on op.Id = d.Id
               WHERE o.XType = 'U' and o.name = 'ListingHdr'
               GROUP BY o.Name, o.Id, op.Name
) x

No comments:

Post a Comment