How to replace a column name in multiple stored procedure efficiently and quickly?

Below are steps to replace column name form multiple stored procedure. Refrence is found here.

Step 1. Press Ctrl+T or change “Result to Text” mode.

Step 2. Execute below comand. Replace “” with text, you want to search in store procedures.

SET NOCOUNT ON
GO
select distinct ‘sp_helptext ”’+OBJECT_SCHEMA_NAME(id)
+’.'+OBJECT_NAME(id)+”’
’ from syscomments where text like ‘%%’
 Order by ‘sp_helptext ”’+OBJECT_SCHEMA_NAME(id)+’.'
+OBJECT_NAME(id)+”’
GO’

Step 3. Now copy the restult and paste in new window. again Press Ctrl+T or change “Result to Text” mode.

Step 4. Copy the result and paste in new window. Execute the query.

Step 5. Copy the result and paste in new window. Now Replace “Text ” with “Go ” with the help of “Find and Replace” in sql.
Remember, set the “Match whole word” option true in “Find and Replace”

Step 6: Replace “—————————————————————————————————————————————————————————————————————————————————————”
with “” with the help of “Find and Replace” in sql.

Step 7. Now find your searching text in the script, make necessary change and execute this script.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s