日期:2014-05-18  浏览次数:20480 次

查找语句
SQL里有几十个存储过程,我想查找某个语句在哪些存储过程里出现过,有没有办法.
比如select name, id from person
如果一个个存储过程打开然后CTRL+F这样查询的话,太废时间了

------解决方案--------------------
SQL code
select object_name(s.object_id)存储过程名,
       definition
from sys.sql_modules s inner join sys.procedures p
on s.object_id=p.object_id
where definition like '%select name, id from person%'

------解决方案--------------------
SQL code

select a.name,b.text from sys.sysobjects a join syscomments b on (a.id = b.id) 
where a.type = 'p' and b.text like '%你要找的字符串%'