How to create database in SQL Server

Database is collection of objects like tables, stored procedures, Views, Functions, Synonyms, etc. There are two ways to create the database in sql server. 1. GUI(graphical user interface) and 2. T-SQL script.

Create database using GUI Mode:

Open SQL Server Management Studio–>Object explorer–>Select the databases folder –> right click –> click on new database as shown below

How to create database in SQL Server

1. Provide the name of the database
2. Provide the min size of the database in MBs
3. Provide the max size of the database in MBs
4. Provide the the file growth rate in mb or by percentage
5. Change the location of data file and log file(optional)

Create Database in SQL Server

Click OK

2. Create database Using TSQL:

CREATE DATABASE [k2tsql]
CONTAINMENT = NONE
ON PRIMARY
( NAME = N’k2tsql’, FILENAME = N’C:\Program Files\Microsoft SQL Server\MSSQL12.PRD1\MSSQL\DATA\k2tsql.mdf’ , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N’k2tsql_log’, FILENAME = N’C:\Program Files\Microsoft SQL Server\MSSQL12.PRD1\MSSQL\DATA\k2tsql_log.ldf’ , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO

To find the description of a database use : sp_helpdb database_name
Example:

sp_helpdb k2tsql

How to create database SQL Server

CheapSexCams
Responses are currently closed, but you can trackback from your own site.

Comments are closed.

Powered by k2schools
%d bloggers like this: