与查询表的外键关系几乎完全相同,但对于SQL Server 2000
对于给定的表'foo',我需要一个查询来生成一组具有指向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'