【问题标题】:Dependency Order of Circular Dependent tables循环依赖表的依赖顺序
【发布时间】:2013-10-07 08:01:35
【问题描述】:

我需要在我的数据库中找到表的依赖层次结构。为此,我使用了“sp_msdependency”,这是一个系统存储过程。由于我的一些表是循环依赖的,因此我无法获得正确的层次结构或顺序。有什么办法可以破解这个问题,让我得到正确的依赖顺序?

【问题讨论】:

标签: sql-server database stored-procedures circular-dependency


【解决方案1】:
To view the objects on which a table depends

SELECT * FROM sys.sql_expression_dependencies
WHERE referenced_id = OBJECT_ID(N'Stock.BookDetails'); 


To view the objects that depend on a table

SELECT * FROM sys.sql_expression_dependencies
WHERE referencing_id = OBJECT_ID(N'Sales.POBooks');

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-09-12
    • 2021-10-02
    • 1970-01-01
    相关资源
    最近更新 更多