Sybase Technical Library - Product Manuals Home
[Search Forms] [Previous Section with Hits] [Next Section with Hits] [Clear Search] Expand Search

Restrictions associated with
stored procedures [Table of Contents] Using stored procedures as security mechanisms

Transact-SQL User's Guide

[-] Chapter 14 Using Stored Procedures
[-] Renaming 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.

Renaming objects referenced by procedures

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.


Restrictions associated with
stored procedures [Table of Contents] Using stored procedures as security mechanisms