SQL Server 2000 - 查询表的外键关系
几乎等同于查询表的外键关系,但对于 SQL Server 2000
Nearly identical to Query a Table's Foreign Key relationships, but for SQL Server 2000
对于给定的表foo",我需要一个查询来生成一组具有指向 foo 的外键的表.
For a given table 'foo', I need a query to generate a set of tables that have foreign keys that point to foo.
推荐答案
SELECT o2.name
FROM sysobjects o
INNER JOIN sysforeignkeys fk on o.id = fk.rkeyid
INNER JOIN sysobjects o2 on fk.fkeyid = o2.id
WHERE o.name = 'foo'
相关文章