Changes the name of a database.
sp_renamedb [@old_name =] 'old_name',
[@new_name =] 'new_name'
0 (success) or a nonzero number (failure)
None
Before a database is renamed, it must be put into single-user mode by using sp_dpoption, and then restored to multiuser mode afterward.
Only members of the sysadmin fixed server role can execute sp_renamedb.
This example changes the name of the accounting database to financial.
EXEC sp_renamedb 'accounting', 'financial'
CREATE DATABASE | sp_helpdb |
sp_changedbowner | sp_rename |
sp_dboption | System Stored Procedures |
sp_depends |