Thursday, July 17, 2008

Renaming a Stored Procedure


Syntax:
sp_rename 'procedure_name1', 'procedure_name2'
procedure_name1
The current name of the stored procedure
procedure_name2
The new name of the stored procedure.

A stored procedure can be renamed. The new name should follow the rules for identifiers.

Examples

Code:
EXEC sp_rename 'spGetAvgGrade', 'spNewAvgGrade';
Output:
Caution: Changing any part of an object name could break scripts and stored procedures.
The object was renamed to 'spNewAvgGrade'.
Explanation:

In the above example we change the name of the stored procedure spGetAvgGrade to spNewAvgGrade.

1 comment:

Yash said...

Thanks for quick help.



yash