如何在一个特定表中查找所有依赖表 [英] How to find all dependent tables in one particular table

查看:59
本文介绍了如何在一个特定表中查找所有依赖表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
如何在一个特定的表中查找所有依赖表

hello,
How to find all dependent tables in one particular table
thanks.

推荐答案

选项1:在表上单击鼠标右键,然后选择查看依赖项".

选项2:列出依赖于给定表的表

Option 1: Right-click on a table and choose ''View Dependencies''.

Option 2:List tables which are dependent on a given table

Select
S.[name] as 'Dependent_Tables'
From
sys.objects S inner join sys.sysreferences R
on S.object_id = R.rkeyid
Where
S.[type] = 'U' AND
R.fkeyid = OBJECT_ID('WB_EMPLOYEE')




在上面的代码中,将WB_EMPLOYEE替换为您的表名.

试试这个



检查此
http://tech-trinkets.blogspot.com/2009/02/get-all-dependent-objects-on-specified.html [




in the above replace WB_EMPLOYEE with your table name.

Try this

or

Check this
http://tech-trinkets.blogspot.com/2009/02/get-all-dependent-objects-on-specified.html[^]


要查看所有依赖项信息,请使用以下命令:

To see all the dependency info, use the following:

SELECT referencing_schema_name, referencing_entity_name,
referencing_id, referencing_class_desc, is_caller_dependent
FROM sys.dm_sql_referencing_entities ('YourObject', 'OBJECT');



更多信息:



More info:

http://blog.sqlauthority.com/2010/02/04/sql-server-get-the-list-of-object-dependencies-sp_depends-and-information_schema-routines-and-sys-dm_sql_referencing_entities/[^]


使用以下脚本来获取正确的依赖关系:

Use the following script to get correct dependency:

SELECT referencing_schema_name, referencing_entity_name,
referencing_id, referencing_class_desc, is_caller_dependent
FROM sys.dm_sql_referencing_entities ('YourObject', 'OBJECT');
GO


这篇关于如何在一个特定表中查找所有依赖表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆