select a.name as 约束名, object_name(b.parent_object_id) as 外键表, d.name as 外键列, object_name(b.referenced_object_id) as 主健表, c.name as 主键列 from sys.foreign_keys A inner join sys.foreign_key_columns B on A.object_id=b.constraint_object_id inner join sys.columns C on B.parent_object_id=C.object_id and B.parent_column_id=C.column_id inner join sys.columns D on B.referenced_object_id=d.object_id and B.referenced_column_id=D.column_id
相关文章
- 10-18code first 添加外键时,与原有的数据冲突ALTER TABLE 语句与 FOREIGN KEY 约束"FK_XXXXX"冲突
- 10-18SqlServer禁用启用触发器、外键约束
- 10-18SQLServer 删除所有表的外键约束
- 10-18达梦数据库查询数据库中所有的外键约束
- 10-18sqlserver查看所有的外键约束
- 10-18SqlServer禁用启用触发器、外键约束
- 10-18SQLServer禁用、启用外键约束
- 10-18SqlServer数据库字典--表.视图.函数.存储过程.触发器.主键.外键.约束.规则.sql
- 10-18(转) SQLSERVER 外键约束 以及它的级联删除