查询SQL Server上存储过程的内容 [英] Query the contents of stored procedures on SQL Server
本文介绍了查询SQL Server上存储过程的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在探索遗留数据库系统,但对其内部结构知之甚少.我想找到所有调用另一个存储过程 A
的存储过程.
I am exploring a legacy database system and have very little knowledge of its internals. I would like to find all the stored procedures that invoke another stored procedure A
.
如何最好地做到这一点?
How best to do this?
我可以写这样的伪代码吗:
Can I write something like this pseudocode:
select name from AllStoredProcedures as Asp where Asp.TextualContent contains 'A'
Asp.TextualContent
表示 SP 中包含的实际 SQL.
Asp.TextualContent
means the actual SQL contained in the SP.
推荐答案
SELECT OBJECT_NAME(object_id),
definition
FROM sys.sql_modules
WHERE objectproperty(object_id,'IsProcedure') = 1
AND definition like '%Foo%'
这篇关于查询SQL Server上存储过程的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文