I am working on SQL SERVER 2008 & 2008 R2. How can I rename a database in multi-user mode? I am using sp_rename but it returns this error:
Msg 15225,
You can't use sp_rename to rename a database - the sp in question would be sp_renamedb. However, that is in line to be removed in a future version of SQL Server and the preferred method is:
ALTER DATABASE dbname MODIFY NAME = newdbname;
But you can't do this anyway without an exclusive lock on the database.