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
 SQL Server Development (2000)
 Renaming stored procedure name

Author  Topic 

pjensen
Starting Member

3 Posts

Posted - 2007-07-25 : 15:50:28
I would like to rename a stored procedure, since it uses sp_, but need older applications to be able to find it using the old name. Is this possible?

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-07-25 : 15:58:21
Not in sql2k.
Go to Top of Page

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-07-25 : 16:44:53
You can "copy" the proc into a new one with the new name and let the "older" apps continue using the other one. But then you have the hassle of maintaining 2 procs for any future enhancements.

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-07-26 : 01:38:56
Or change the old one to just EXEC the new one?

We do that for backward compatibility sometimes, and then after a while, when we think we have removed all the code that uses the old name, we change the Old Sproc to "log" any calls, so that we can check after a month or two if it is still REALLY used! and if not we Drop it.

Kristen
Go to Top of Page

pjensen
Starting Member

3 Posts

Posted - 2007-07-30 : 12:20:17
Thanks for the info. I will probably run the two sp's for a while then have the old one exec the new one. Eventually getting rid of the old one.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-07-30 : 12:32:34
"I will probably run the two sp's for a while"

Just to sow a seed of doubt!

This approach means that you:

a) Have to remember to update OLD if there is an equivalent change to NEW
b) Have to debug twice - once with NEW Sproc, and again with Old-calls-New.

Personally I would go straight to:

Install NEW Sproc & change Old Sproc to exec New Sproc. (and get Old Sproc to do some logging, if you want to have that functionality)

Kristen
Go to Top of Page

pjensen
Starting Member

3 Posts

Posted - 2007-07-30 : 13:18:35
Actually, I should have said that I will change the old one to exec the new one once tested is completed on the new one. My new sp should have a big performance boost over the old one, it just needs testing.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-07-30 : 15:16:30
Excellent! Hope it goes well.
Go to Top of Page
   

- Advertisement -