• This SP will find the desired text as shown in the procedure and can be used in SQL 2000 and 2005 - note it will find the watchword even if it is in a comment within the SP or Function

    CREATE PROCEDURE UDP_FindWordsInaSP

    @Watchword varchar(50)

    AS

    SELECT distinct

    'type' = case type

    when 'FN' then 'Scalar function'

    when 'IF' then 'Inlined table-function'

    when 'P' then 'Stored procedure'

    when 'TF' then 'Table function'

    when 'TR' then 'Trigger'

    when 'V' then 'View'

    end,

    o.[name],

    watchword = @Watchword

    FROM dbo.sysobjects o (NOLOCK)

    JOIN dbo.syscomments c (NOLOCK)

    ON o.id = c.id

    WHERE charindex(lower(@Watchword),lower(text)) <> 0

    and o.type in ('FN', 'IF', 'P', 'TF', 'TR', 'V')

    and o.name NOT LIKE 'dt%' and o.name NOT LIKe 'sys%'

    and o.name NOT LIKE 'UDP_FindWordsInaSP'

    ORDER BY type, o.[name]

    -- run as UDP_FindWordsInaSP 'your table name''

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]