一、查出与表相关的存储过程,比如说。
二、查出某个存储过程所有用到的表。

解决方案 »

  1.   

    比如说有表table1 
    现在我就想得到:所有对table1操作的存储过程。
      

  2.   

    exec master..sp_helptext sp_helptext
    看看存储过程的内容是怎么得到的,然后自己取里面找吧.
      

  3.   

    也或许这个能满足你的要求,加密的存储过程不行.
    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 '%你的表名%'
      

  4.   

    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
      

  5.   

    指定存储过程名、表名可在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
      

  6.   

    知我者 47522341  ,bugchen888(臭虫) 分不给你们都难,但是贫富悬殊越来越大了!