Changing the database name from DCWEB to DCWEB_TEST

The following is an example of how to change a database name.

CreateDB8x.sql:


USE master;

if exists (select 1 from dbo.sysdatabases where name='DCWEB_TEST')
DROP DATABASE [DCWEB_TEST];

CREATE DATABASE [DCWEB_TEST]
ON PRIMARY(            NAME = DCDATA_PRIMIRY,
FILENAME = 'D:\DB\DCWEB_TEST_primary.mdf', SIZE = 20,   FILEGROWTH = 5%  ),
FILEGROUP DCDATA_SESN( NAME = DCDATA_SESN,
FILENAME = 'D:\DB\DCWEB_TEST_SESN.mdf',    SIZE = 50,   FILEGROWTH = 20% ),
FILEGROUP DCDATA_HIT(  NAME = DCDATA_HIT,
FILENAME = 'D:\DB\DCWEB_TEST_HIT.mdf',     SIZE = 50,   FILEGROWTH = 20% ),
FILEGROUP DCDATA_APPD( NAME = DCDATA_APPD,
FILENAME = 'D:\DB\DCWEB_TEST_APPD.mdf',    SIZE = 50,   FILEGROWTH = 20% ),
FILEGROUP DCDATA_FACT( NAME = DCDATA_FACT,
FILENAME = 'D:\DB\DCWEB_TEST_FACT.mdf',    SIZE = 50,   FILEGROWTH = 20% ),
FILEGROUP DCDATA_COOK( NAME = DCDATA_COOK,
FILENAME = 'D:\DB\DCWEB_TEST_COOK.mdf',    SIZE = 50,   FILEGROWTH = 20% ),
FILEGROUP DCDATA_EVNT( NAME = DCDATA_EVNT,
FILENAME = 'D:\DB\DCWEB_TEST_EVNT.mdf',    SIZE = 50,   FILEGROWTH = 20% ),
FILEGROUP DCDATA_ATTR( NAME = DCDATA_ATTR,
FILENAME = 'C:\DB\DCWEB_ATTR.mdf',    SIZE = 50,   FILEGROWTH = 20% ),

FILEGROUP DCIDX_SESN(  NAME = DCIDX_SESN,
FILENAME = 'D:\DB\DCIDX_TEST_SESN.mdf',    SIZE = 50,   FILEGROWTH = 20% ),
FILEGROUP DCIDX_HIT(   NAME = DCIDX_HIT,
FILENAME = 'D:\DB\DCIDX_TEST_HIT.mdf',     SIZE = 50,   FILEGROWTH = 20% ),
FILEGROUP DCIDX_APPD(  NAME = DCIDX_APPD,
FILENAME = 'D:\DB\DCIDX_TEST_APPD.mdf',    SIZE = 50,   FILEGROWTH = 20% ),
FILEGROUP DCIDX_FACT(  NAME = DCIDX_FACT,
FILENAME = 'D:\DB\DCIDX_TEST_FACT.mdf',    SIZE = 50,   FILEGROWTH = 20% ),
FILEGROUP DCIDX_COOK(  NAME = DCIDX_COOK,
FILENAME = 'D:\DB\DCIDX_TEST_COOK.mdf',    SIZE = 50,   FILEGROWTH = 20% ),
FILEGROUP DCIDX_EVNT(  NAME = DCIDX_EVNT,
FILENAME = 'D:\DB\DCIDX_TEST_EVNT.mdf',    SIZE = 50,   FILEGROWTH = 20% ),
FILEGROUP DCIDX_ATTR(  NAME = DCIDX_ATTR,
FILENAME = 'C:\DB\DCIDX_ATTR.mdf',    SIZE = 50,   FILEGROWTH = 20% )

LOG ON(                NAME = 'DCDATA_LOG',
FILENAME = 'D:\DB\DCWEB_TEST_log.ldf',     SIZE = 5,    FILEGROWTH = 5 );
ALTER DATABASE [DCWEB_TEST] SET RECOVERY SIMPLE;

CreateSchema8x.sql:


:
USE [DCWEB_TEST]
...