在SQL Server中,如何使用系统表/视图识别特定表的“所有”依赖项? [英] In SQL Server, how do I identify *all* dependencies for a specific table using system tables/views?
本文介绍了在SQL Server中,如何使用系统表/视图识别特定表的“所有”依赖项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在编写一个DDL脚本来删除许多表,但是需要首先确定这些表的所有依赖关系。这些依赖项包括外键约束,存储过程,视图等。优选地,我想以编程方式编写脚本,以在删除依赖表之前使用系统表/视图删除那些依赖项。
I am writing a DDL script to drop a number of tables but need to identify all dependencies for those tables first. Those dependencies include foreign key constraints, stored procedures, views, etc. Preferably, I want to programmatically script out dropping those dependencies using the system tables/views before dropping the dependent table.
推荐答案
从头开始编写非常混乱。您是否考虑过第三方工具,例如
Red-Gate SQL Dependency Tracker ?
This is extremely messy to write from scratch. Have you considered a 3rd party tool like Red-Gate SQL Dependency Tracker?
这篇关于在SQL Server中,如何使用系统表/视图识别特定表的“所有”依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文