也或许这个能满足你的要求,加密的存储过程不行. select distinct o.name from sysobjects o,syscomments cm where o.xtype = 'P' and o.id = cm.id and cm.encrypted = 0 and cm.text like '%你的表名%'
select distinct b.name 存储过程名,c.name 依赖表名 from sysdepends a,sysobjects b,sysobjects c where a.id=b.id and b.type='p' and a.depid=c.id and c.type='u' order by 1,2
指定存储过程名、表名可在where子句中加入 一、查出与表相关的存储过程 select distinct c.name 表名,b.name 存储过程名 from sysdepends a,sysobjects b,sysobjects c where a.id=b.id and b.type='p' and a.depid=c.id and c.type='u' order by 1,2 二、查出某个存储过程所有用到的表 select distinct b.name 存储过程名,c.name 依赖表名 from sysdepends a,sysobjects b,sysobjects c where a.id=b.id and b.type='p' and a.depid=c.id and c.type='u' order by 1,2
现在我就想得到:所有对table1操作的存储过程。
看看存储过程的内容是怎么得到的,然后自己取里面找吧.
select distinct o.name
from sysobjects o,syscomments cm
where o.xtype = 'P' and
o.id = cm.id and
cm.encrypted = 0
and cm.text like '%你的表名%'
where a.id=b.id and b.type='p' and a.depid=c.id and c.type='u'
order by 1,2
一、查出与表相关的存储过程
select distinct c.name 表名,b.name 存储过程名 from sysdepends a,sysobjects b,sysobjects c
where a.id=b.id and b.type='p' and a.depid=c.id and c.type='u'
order by 1,2
二、查出某个存储过程所有用到的表
select distinct b.name 存储过程名,c.name 依赖表名 from sysdepends a,sysobjects b,sysobjects c
where a.id=b.id and b.type='p' and a.depid=c.id and c.type='u'
order by 1,2