Friday, June 05, 2009

How to find referenced table in MS SQL 2005?

SELECT so.name
FROM sysobjects so INNER JOIN
sysreferences sr ON so.id = sr.rkeyid
WHERE (so.type = 'U') AND (sr.fkeyid = OBJECT_ID('Customer'))

Result:
name
CustomerGroup
CustomerCountry
Rating
CustomerType

No comments: