sql – 查看具有表中某列的外键的所有表?

这可能吗 ?如果是,所涉及的表格是什么,可以在哪里查看.

解决方法

尝试这样的事情

select uc.table_name 
from sys.user_cons_columns ucc
join sys.user_constraints uc 
on uc.r_constraint_name = ucc.constraint_name
where constraint_type = 'R'
and ucc.table_name = :1
and ucc.column_name = :2

哪里

:1 = referenced table
:2 = referenced column

dawei

【声明】:唐山站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。