当前位置: 代码迷 >> Sql Server >> 已知表名,怎么获取该表的依赖表
  详细解决方案

已知表名,怎么获取该表的依赖表

热度:132   发布时间:2016-04-27 19:28:11.0
已知表名,如何获取该表的依赖表?
RT

------解决方案--------------------
SQL code
exec sp_depends '已知表名'
------解决方案--------------------
如果查外健关系: 
create table t1(ID int primary key ) 

create table t2(ID int constraint FK_t2 foreign key references t1(ID)) 


select
object_name(fkeyID),object_name(rkeyID)
from
sysforeignkeys
where
fkeyID=object_id( 't2 ')
  相关解决方案