确定存储过程的依赖关系。 [英] Determining the dependencies of a stored procedure.
问题描述
是否有一种方法(或理想的查询)来确定存储过程访问的所有表,包括由其自身调用的其他存储过程访问的表(以及他们调用的那些表等)调用堆栈)
Is there a way (or, ideally, a query) to determine all the tables that a stored procedure accesses, including those accessed by other stored procs that it calls itself (and those that they call, etc. down the call stack).
如果有人可以制作这样的查询,是否还可以确定是否访问表格进行更新,选择或删除?
If anyone can fabricate such a query, is it additionally possible to determine whether tables are accessed for update, select or delete?
是否可以确定视图投入组合的相同?
Is it possible to determine the same where views are thrown into the mix?
我的存储过程不包含任何动态构造的调用,所以
My stored procs do not contain any dynamically-constructed calls, so that simplifies it at least slightly.
推荐答案
尝试此链接:
如何-to-find-all-dependencies-of-a-table-in-sql-server
或者搜索文本:
DECLARE @Search varchar(255)
SET @Search='cost_centre'
SELECT DISTINCT
o.name AS Object_Name,o.type_desc
FROM sys.sql_modules m
INNER JOIN sys.objects o ON m.object_id=o.object_id
WHERE m.definition Like '%'+@Search+'%'
ORDER BY 2,1
这篇关于确定存储过程的依赖关系。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!