Quickest/Easiest way to use Search/Replace through all stored procedures

前端 未结 13 1135
萌比男神i
萌比男神i 2020-12-30 03:05

Actually, this is a 2 part question.

  1. Is it possible to use some sort of functionality to search through every stored procedure for a string and possibly rep

13条回答
  •  無奈伤痛
    2020-12-30 03:21

    I just run this code to find a specific text in all stored procedures:

    SELECT DISTINCT 
       o.name AS Object_Name,
       o.type_desc
     FROM sys.sql_modules m 
       INNER JOIN 
       sys.objects o 
         ON m.object_id = o.object_id
    WHERE m.definition Like '%textToFind%'
       or m.definition Like '%\[ifTextIsAColNameWithBrackets\]%' ESCAPE '\';
    

提交回复
热议问题