Searching in SQL Management Studio 2005

前端 未结 5 1486
逝去的感伤
逝去的感伤 2021-01-16 09:11

Is there a way to search for text within stored procedures? For example I want to find out if a particular table is being referenced by any stored procedure.

5条回答
  •  误落风尘
    2021-01-16 09:45

    SELECT
       OBJECT_SCHEMA_NAME(object_id) + '.' + OBJECT_NAME(object_id)
    FROM
       sys.sql_modules
    WHERE
       definition like '%whatever%'
    

    syscomments is legacy and splits the definition into nvarchar 4000 chunks thus risking not finding what you want. The same applies to INFORMATION_SCHEMA.ROUTINES

提交回复
热议问题