Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Rename column name in the stored procedure

Author  Topic 

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2006-07-10 : 18:06:31
I have around 25 stored procedures in the Prod which uses a column called 'used_flag' which is char(1).Now this field has changed to process_used_flag in the table (basically renamed).

Is there any way I can change all the columns in these 25 stored procedure to process_used_flag.

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-07-10 : 18:19:36
quote:
Originally posted by sqllearner

I have around 25 stored procedures in the Prod which uses a column called 'used_flag' which is char(1).Now this field has changed to process_used_flag in the table (basically renamed).

Is there any way I can change all the columns in these 25 stored procedure to process_used_flag.



Script the procedures out into Query Analyzer and use find and replace to change the column names.

When you are done changing them, compile the procedures and test them.

Repeat until done.




CODO ERGO SUM
Go to Top of Page

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2006-07-10 : 18:57:39
Is there any script that I can run so that I don't have to script out all the stored procedures and replace to change the columns.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-07-10 : 19:02:20
quote:
Originally posted by sqllearner

Is there any script that I can run so that I don't have to script out all the stored procedures and replace to change the columns.



That's a 5 minute task. Why do you need an alternative? Enterprise Manager allows you to script out the objects to one file (takes about 1 minute). Then open the file, do a find/replace (another minute). Save the file, then run it in Query Analyzer (another minute). I can't imagine why you'd want an alternative.

An alternative though would be to update syscomments directly. However, I highly do not recommend this method. You could end up really messing things up.

Tara Kizer
aka tduggan
Go to Top of Page

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2006-07-10 : 19:41:13
Thanks a lot...I will replace it....
Go to Top of Page
   

- Advertisement -