Previous | Home | Next |
The creation of a database involves the database and determining the size of the database and the files used to store data in the database.
CREATE DATABASE database_name ON [<filespace>...n] [<filegroup>...n] LOG ON (NAME=logical_file_name, FILENAME='os_file_name', SIZE=size,MAXSIZE=max_size, FILEGROWTH=growth_increment)
where, data_base name is the name of new database.
ON specifies the disk files used to store the data portion of the database.
NAME=logical_file_name specifies the logical name for the file.
FILENAME=os_file_name specifies the operating system file name.
SIZE=size specifies the initial size f the file defined in the (<filespace>) list.
MAXSIZE=max_size specifies the maximum size to which the file defined in the <filespace> list can grow
FILEGROWTH=growth_incremet specifies the growth increament of the file defined in the <filespace> list.
FILEGROUP filegroup_name name specifies the name of the filegroup.
LOG ON specifies the disk files used to store the log files.
Example:
CREATE DATABASE aditya ON (NAME=aditya_dat, FILENAME='C:\Program Files\Microsoft SQL Server\MSSQL\DATA\aditya.mdf', SIZE=12, MAXSIZE=100, FILEGROWTH=2) LOG ON (NAME='aditya_log', FILENAME='C:\Program Files\Microsoft SQL Server\MSSQL\DATA\aditya.ldf', SIZE=4 MB, MAXSIZE=50 MB, FILEGROWTH=2 MB)
The CREATE DATABASE process is allocating 12.00 MB on disk 'aditya_dat'.
The CREATE DATABASE process is allocating 4.00 MB on disk 'aditya_log'.
output
Aditya named database created
Previous | Home | Next |