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

问题描述

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

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

推荐答案

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[^]


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/[^]


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


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

09-03 09:58