Sunday, February 26, 2012

Find and Replace.

Does anybody know how to search through all stored procedures (in SQL Server 2000) and find and replace text without having to open each one individually in Query Analyzer and doing so one at a time?

That would be so time consuming. I want to be able to change my table names, but I have so many stored procedures allready using the old names. To go and find each name and replacing them is a task I don't want to even try and do.

Thank you to whomever can help.

Alecgo to enterprise manager > your database >
stored procedures > select all >
right click > All Tasks > Generate SQL Script >
click the Options Tab > check the box "Script Object Permission" >
hit the OK button and save this as a file.

then you can open this file up and do search and replace as you wish.
the file should contain sp drop statements followed by CREATE procedure statements

after you have masaged the file run it in QA
I recommend backing up your database first.

No comments:

Post a Comment