Personal Notes of Edwin Eu

SQL Server – Create a database

In Microsoft SQL Server on 06/12/2012 at 9:00 AM

How to create a database

CREATE DATABASE TestDB ON PRIMARY
 (NAME = N’TestDB_Data’, FILENAME = N’M:\SQL_Data\TestDB.mdf’,
  SIZE = 8MB, MAXSIZE = UNLIMITED, FILEGROWTH = 16MB),
 FILEGROUP FG1
 (NAME = N’TestDB_Data2′, FILENAME = N’M:\SQL_Data\TestDB.ndf’,
  SIZE = 8MB, MAXSIZE = UNLIMITED, FILEGROWTH = 16MB),
 FILEGROUP Documents CONTAINS FILESTREAM DEFAULT
 (NAME = N’Documents’, FILENAME = N’M:\SQL_Data\TestDBDocuments’)

LOG ON
 (NAME =N’TestDB_Log’, FILENAME = N’L:\SQL_Log\TestDB.ldf’,
 SIZE = 8MB, MAXSIZE = 2048GB, FILEGROWTH = 16MB)
GO
ALTER DATABASE TestDB
MODIFY FILEGROUP FG1
DEFAULT
GO

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: