使用sys.dm_sql_referended_entities和sys.sys.dm_sql_referencing_entities s sql Server中的数据谱系查询
我处于数据仓库环境中,该环境通过存储过程生成表,存储过程引用其他表,这些表由其他存储过程创建,等等。我想为给定的过程或表,能够将一路追溯到源表,有效地为给定对象构造依赖关系链。
我可以使用 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论