sp_rename is a system stored procedure which is used to rename the database objects in sql server.
Using sp_rename any database object (table, stored procedure, view, column etc.,) can be rename .
Syntax for sp_rename is:
(or)
@objtype in the above syntax represents database object type . By default this is NULL.
Example to Rename database 'Example' to 'Sample' following query can be used.
Using sp_rename any database object (table, stored procedure, view, column etc.,) can be rename .
Syntax for sp_rename is:
sp_rename <old database object Name> , <New database object Name>
(or)
sp_rename @objname = <object old name>,
@newname =<object new name>,
@objtype = <Type of the database object>
@objtype in the above syntax represents database object type . By default this is NULL.
Example to Rename database 'Example' to 'Sample' following query can be used.
sp_rename 'Example','Sample','DATABASE'