--1、查询一个字符串在哪些存储过程或者触发器中出现过
select
distinct a.name
from
sysobjects a,syscomments b
where
a.id=b.id and a.xtype in('P','TR')
and
charindex(@str,cast(b.ctext as varchar(8000)))>0
--2、查询一个字符串在哪些表或者视图中出现过
select
distinct a.name
from
sysobjects a,syscomments b
where
a.id=b.id and a.xtype in('U','V')
and
charindex(@str,cast(b.ctext as varchar(8000)))>0
select
distinct a.name
from
sysobjects a,syscomments b
where
a.id=b.id and a.xtype in('P','TR','V')
and
charindex(@str,cast(b.ctext as varchar(8000)))>0