I cannot run this script because SQL 2008 management studio says that the table "NewName" does not exist. However, the purpose of the script is to rename an existing database so that it exists when it falls into this line. Ideas?
Use Master;
ALTER DATABASE OldName SET SINGLE_USER WITH NO_WAIT;
ALTER DATABASE OldName MODIFY NAME = NewName;
ALTER DATABASE NewName SET MULTI_USER;
Use NewName;
source
share