SQL

select fk.name,OBJECT_NAME(fk.parent_object_id) as referenceTableName
from sys.foreign_keys as fk
join sys.objects as o on fk.referenced_object_id=o.object_id
where o.name='Category'

 

查找视图的表依赖:

sp_depends '视图名'

http://technet.microsoft.com/zh-cn/library/ms189487(zh-tw,SQL.90).aspx

 

查找存储过程与表的依赖:

select OBJECT_NAME(object_id) as name , OBJECT_NAME(referenced_major_id) as refTable, * 
from sys.sql_dependencies

http://technet.microsoft.com/zh-cn/library/ms174402(v=sql.90).aspx

 

不过 sys.sql_dependencies 官方已经不推荐了,而改用内容更丰富的: sys.sql_expression_dependencies

 http://msdn.microsoft.com/zh-SG/library/bb677315

 

无法删除表,提示被外键约束引用的解决_干货   作者:NewSea    

  如无特别标记说明,均为NewSea原创,版权私有,翻载必纠。欢迎交流,转载,但要在页面明显位置给出原文连接。谢谢。