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

前端 未结 13 1185
萌比男神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:43

    Stored procedures cannot be updated in place without first scripting them out as ALTER PROCEDURE statements (or DROP/CREATE, but I prefer ALTER PROCEDURE..more on that in a moment). The good news is, you can script all the procedures to a single file through SSMS. The DDL statements will initially be CREATE PROCEDURE, which you'll want to replace with ALTER PROCEDURE, along with your other changes.

    While you could alternatively script the procedures as DROP/CREATE, I don't like doing this for a large number of scripts because it tends to cause dependency errors.

    As for part 2 of your question, you'll need to edit any database path changes manually through the script.

提交回复
热议问题