且构网

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

检查 SQL 对象是否被任何其他 SQL 对象引用

更新时间:2023-11-29 09:24:58

可以,但不是用DMV,而是需要相关的动态管理function(DMF) dm_sql_referencing_entities(更多信息这里).

You can, but not with a DMV instead you'll need a related dynamic management function(DMF) dm_sql_referencing_entities (more info here).

代码如下:

SELECT referencing_schema_name
     , referencing_entity_name
FROM sys.dm_sql_referencing_entities ('*schemaname.objectname*', 'OBJECT');

这是关于 DMV 和 DMF 的链接到 MSDN 页面.

Here's a link to the MSDN page on DMVs and DMFs.