SQL INDONESIA

Personal Notes of Edwin Eu

SQL Server – Create a database

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 comment

Navigation

About

Writing on the Wall is a newsletter for freelance writers seeking inspiration, advice, and support on their creative journey.