使用sys.dm_sql_referended_entities和sys.sys.dm_sql_referencing_entities s sql Server中的数据谱系查询

发布于 2025-02-10 16:54:12 字数 856 浏览 0 评论 0原文

我处于数据仓库环境中,该环境通过存储过程生成表,存储过程引用其他表,这些表由其他存储过程创建,等等。我想为给定的过程或表,能够将一路追溯到源表,有效地为给定对象构造依赖关系链。

我可以使用 sys.dm_sql_referended_entities 用于程序和 nofollow noreferrer”> 对于表来说,但这些仅显示链中的第一个链接。据推测,这是某种递归查询,当它发现没有更多依赖性时停止?有人以前做过这件事,可以分享如何做吗?

谢谢。

I'm in a Data Warehouse environment where tables are generated by stored procedures, the stored procedures reference other tables, and those referenced tables are created by other stored procedures, and so on etc. I'd like to, for a given procedure or table, be able to trace back all the way to the source tables, effectively constructing a dependency chain for the given object.

I can use sys.dm_sql_referenced_entities for procedures and sys.dm_sql_referencing_entities for tables but these only reveal the first link in the chain. Presumably this is some kind of recursive query that stops when it finds no more dependencies? Has anyone done this before and can share how to do it?

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文