How to create a database in sql server with Tsql
In this post we learn How to create a database in sql server with Tsql. In this script we define where to place files(MDF,LDF) about their size and auto-growth of the database file size.And also in which file-group the file should be placed.
Script:-
create
database test onprimary( name=N’test’,
filename=N’C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\test.mdf’, Size=10MB,Filegrowth=2MB),
Filegroup secondry
(NAME =N’FILEGRP2′, fILEname =N’C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\filegrp2.ndf’,Size=10MB,Filegrowth=2MB)
LOG ON ( Name =N’test_log’, filename =N’C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\test.ldf’,Size=10MB,Filegrowth=2MB)