博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
取得库中所有的外键
阅读量:4212 次
发布时间:2019-05-26

本文共 759 字,大约阅读时间需要 2 分钟。

select a.外键,b.tbl_nme as 主表,b.col_nme as 主列,c.tbl_nme as 参照表,c.col_nme as 参照列

from
(select a.name as 外键,a.parent_object_id,b.parent_column_id,a.referenced_object_id,b.referenced_column_id
from sys.foreign_keys a
left join sys.foreign_key_columns b
on a.object_id=b.constraint_object_id ) as a
left join
(
select b.name as tbl_nme,a.name as col_nme,b.id as obj_id,a.colid  from syscolumns a
left join sysobjects b
on a.id=b.id
where b.xtype='u'
) b
on a.parent_object_id=b.obj_id and a.parent_column_id=b.colid
left join
(
select b.name as tbl_nme,a.name as col_nme,b.id as obj_id,a.colid  from syscolumns a
left join sysobjects b
on a.id=b.id
where b.xtype='u'
) c
on a.referenced_object_id=c.obj_id and a.referenced_column_id=c.colid
where c.tbl_nme='main_per'

转载地址:http://pwbmi.baihongyu.com/

你可能感兴趣的文章
xarray的简单使用
查看>>
pkg-config
查看>>
网口bond的时候如何选择slave
查看>>
ko的--strip-debug
查看>>
Gitp clone时 SSL certificate problem
查看>>
liteos的启动
查看>>
liteos线程的建立和线程优先级选择的策略
查看>>
liteos 中timer 的创建和运行
查看>>
liteos中sem的使用
查看>>
liteos中event的使用
查看>>
liteos的动态内存的管理
查看>>
atop 在centos的使用
查看>>
liteos中中断的注册
查看>>
Lwm2m的server分析
查看>>
Nginx 由于写log造成的性能瓶颈
查看>>
Lwm2m的client分析
查看>>
dpdk的编译
查看>>
通过readelf -p .comment来检查ko编译时用到的gcc 版本
查看>>
liteos中每个task的时间片默认是10个时钟周期
查看>>
python cmd 模块测试
查看>>