Creating User Defined Databases in SQL Server.
As a user we can create a User Defined
Database in SQL Server. This database can store tables, views, stored procedures,
functions etc. Every database has got two files:
a.
MDF File
This is the main data file in which data is stored.
b.
LDF File
LDF primarily stores all the logs. Logs are nothing but recording of
every activity going in the database like inserting, deleting, updating etc.
for the purpose of backup and retrieval.
The following command can be used to create a Database in SQL Server
Management Studio.
USE [master]
GO
CREATE DATABASE Test
On
Primary
(
NAME = N'Test', FILENAME = N'C:\Temp\Test.mdf',
SIZE = 167872KB, MAXSIZE = UNLIMITED, FILEGROWTH = 16384KB
)
LOG
ON
(
NAME = N'Test_Log', FILENAME = N'C:\Temp\Test_Log.ldf',
SIZE = 2048KB, MAXSIZE = 2048GB, FILEGROWTH = 16384KB
)
GO
In the above command, we are doing the following:
a.
We are creating a Database named “TEST”
b.
We are creating a Data file named “Test.mdf” and log file “Test_log.ldf”
c.
We are also specifying Size, MaxSize
and FileGrowth parameters in the command.
d.
We are creating Database files in the Temp
Folder in C Drive.
Stay tuned for more stuff on SQL Server.!!!!
Comments