CREATE DATABASE database_name
ON
PRIMARY
( NAME = name,
FILENAME = 'path_of_mdf_file',
SIZE = size_of_file,
MAXSIZE = Maximum_size,
FILEGROWTH = growth_size)
LOG ON
( NAME = name,
FILENAME = 'path_of_log_file',
SIZE = size_of_file,
MAXSIZE = Maximum_size,
FILEGROWTH = growth_size)
ON
PRIMARY
( NAME = name,
FILENAME = 'path_of_mdf_file',
SIZE = size_of_file,
MAXSIZE = Maximum_size,
FILEGROWTH = growth_size)
LOG ON
( NAME = name,
FILENAME = 'path_of_log_file',
SIZE = size_of_file,
MAXSIZE = Maximum_size,
FILEGROWTH = growth_size)
database_name : This refers to the database.
ON PRIMARY : This specifies to which filegroup this database file is a member. The default filegroup is Primary.
NAME : Logical name which is used within SQL Server.
FILENAME : Path name where physical file is on the hard disk.
SIZE: Size of file, expressed in either megabytes (MB)or kilobytes (KB).
MAXSIZE: Maximum size of which the database can dynamically grow. If it is not specified, the autogrowth option is turned on and full hard disk may be used.
FILEGROWTH : Increments are used for autogrowth of this database file. If not specified then it is 1 MB.
Example :
ON PRIMARY : This specifies to which filegroup this database file is a member. The default filegroup is Primary.
NAME : Logical name which is used within SQL Server.
FILENAME : Path name where physical file is on the hard disk.
SIZE: Size of file, expressed in either megabytes (MB)or kilobytes (KB).
MAXSIZE: Maximum size of which the database can dynamically grow. If it is not specified, the autogrowth option is turned on and full hard disk may be used.
FILEGROWTH : Increments are used for autogrowth of this database file. If not specified then it is 1 MB.
Example :
CREATE DATABASE myshop
PRIMARY
( NAME = shop,
FILENAME = 'c:datamyshop.mdf',
SIZE = 150MB,
MAXSIZE =300MB,
FILEGROWTH = 10%)
LOG ON
( NAME = myshoplog,
FILENAME = 'c:datamyshop.ldf',
SIZE = 150MB,
MAXSIZE = 300MB,
FILEGROWTH = 10%)