且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在一个特定表中查找所有依赖表

更新时间:2023-01-30 12:37:33

选项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