How to find a text inside SQL Server procedures / triggers?

后端 未结 14 762
一个人的身影
一个人的身影 2020-12-04 04:48

I have a linkedserver that will change. Some procedures call the linked server like this: [10.10.100.50].dbo.SPROCEDURE_EXAMPLE. We have triggers also doing thi

14条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-04 05:21

    This will work for you:

    use [ANALYTICS]  ---> put your DB name here
    GO
    SELECT sm.object_id, OBJECT_NAME(sm.object_id) AS object_name, o.type, o.type_desc, sm.definition
    FROM sys.sql_modules AS sm
    JOIN sys.objects AS o ON sm.object_id = o.object_id
    where sm.definition like '%SEARCH_WORD_HERE%' collate SQL_Latin1_General_CP1_CI_AS
    ORDER BY o.type;
    GO
    

提交回复
热议问题