数据库里写了很多存储过程,想用SQL语句查出哪些存储过程包含字段(如:user_id)

解决方案 »

  1.   

    [code=SQLl]
    select * from sys.objects s where s.type='p' and s.name like '%user_id%'[/code]
      

  2.   

    [code=SQ]Lselect name from sysobjects where id in (select id from syscomments where text like '%user_id%')[/code]
      

  3.   

    我用的方法是tasks里把所有存储过程保存出来,然后用nodpad++打开搜索
      

  4.   

    谢谢,3楼的方法最好使:
    Lselect name from sysobjects where id in (select id from syscomments where text like '%user_id%'不仅能查字段,连备注里的东西都能查出,太强了,谢谢!!