Tuesday, 17 July 2012

Create Database Using Manual FileGroup Creation

There are two Filegroups for newly created database :-


Primary File Group - MDF
Secondary File Froup - LDF


Creation of New Database:-



CREATE DATABASE [ DemoTest ] ON  PRIMARY
( NAME =  DemoTest ',
FILENAME = C:\data\ DemoTest .mdf' ,
SIZE = 3072KB , 
FILEGROWTH = 1024KB ),
FILEGROUP [Secondary]
( NAME =  DemoTestSecondry',
FILENAME =   C:\data\ DemoTest2.ndf' ,
SIZE = 3072KB , FILEGROWTH = 1024KB )
LOG ON
( NAME =   C:\data\ DemoTestlog',
FILENAME =  C:\data\ DemoTest Log.ldf' ,
SIZE = 1024KB , FILEGROWTH = 10%)
GO


To use this query you must have data folder in your c drive or you can also specify your own database database folder.



No comments:

Post a Comment