Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
就像它在锡上说的那样。如何确定哪些 SQL 对象正在使用给定的 SYNONYM?我想一种方法是搜索 PROC 或 VIEW 的所有内容并运行 a LIKE '%SYN_NAME%',但这似乎很笨拙。
LIKE '%SYN_NAME%'
select * from sys.sql_expression_dependencies where referenced_id = object_id('<syn schema>.<syn name>')
此视图允许访问依赖关系树。因此,如果想要引用 this 返回的对象的对象,您将需要递归或类似的方法。
您可以通过连接到 sys.objects 或使用 objectproperty() 来限制视图