![]() | ![]() |
Home |
|
|
Transact-SQL User's Guide |
|
| Chapter 14 Using Stored Procedures |
|
| Renaming stored procedures |
Use sp_rename to rename stored procedures. Its syntax is:
sp_rename objname, newname
For example, to rename showall to countall:
sp_rename showall, countall
The new name must follow the rules for identifiers. You can change the name only of stored procedures that you own. The Database Owner can change the name of any user's stored procedure. The stored procedure must be in the current database.
You must drop and re-create a procedure if you rename any of the objects it references. A stored procedure that references a table or view whose name has been changed may seem to work fine for a while. In fact, it works only until Adaptive Server recompiles it. Recompilation takes place for many reasons and without notification to the user.
Use sp_depends to get a report of the objects referenced by a procedure.
|
|