Changes the name of a database.
sp_renamedb oldname, newname
where
Only the system administrator can change the name of a database. The system administrator must put a database in single-user mode by using sp_dboption before renaming it, and must restore it to multi-user mode afterward.
This example changes the name of the accounting database to financial.
sp_renamedb accounting, financial
Execute permission defaults to the system administrator.
master.dbo.sysdatabases
CREATE DATABASE | sp_depends |
sp_changedbowner | sp_helpdb |
sp_dboption | sp_rename |