Text search in stored proc SQL Server

前端 未结 4 931
[愿得一人]
[愿得一人] 2020-12-17 00:27

Does any one know the script to use for text search in SQL Server? I would like to search a text from all the stored proc inside the SQL Server, does anyone know what is the

4条回答
  •  孤城傲影
    2020-12-17 00:46

    INFORMATION_SCHEMA.ROUTINES or syscomments are not reliable.

    The text field is nvarchar(4000) for both (over multiple rows syscomments only). So your search text can be lost on the boundary for a syscomments or never found for INFORMATION_SCHEMA.ROUTINES

    sys.sql_modules.definition is nvarchar(max)

    SELECT
        OBJECT_NAME(object_id)
    FROM
        sys.sql_modules
    WHERE
        definition LIKE '%mytext%'
    

    Edit, Oct 2011

    Bringing this answer up to date.

    Red Gate SQL Search is a free SSMS plug in that is quite useful.

提交回复
热议问题