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
 Development Tools
 ASP.NET
 rename all sps with sp_ as prefix at once

Author  Topic 

Swati Jain
Posting Yak Master

139 Posts

Posted - 2007-08-22 : 01:04:12
In sql server 2005 I want to rename all sps with sp_ as prefix
What query to execute? or I have to rename it one by one

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-08-22 : 01:14:04
It is a very bad practice to prefix stored procedures with sp_. Any other prefix is fine just not sp_. This is because SQL Server checks for the object in the master database before checking in the current database. You receive a performance penalty due to this. sp_ should always be avoided for the prefix of stored procedures unless you are building system stored procedures, which is doubtful.

To do the rename though, you can use sp_rename along with the INFORMATION_SCHEMA.ROUTINES view.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -