SQL Server has two option to create
database. You can create database by using interface or
by executing SQL Query.
Create Database from Interface:
1)Go to SQL server management Studio , you will see the database.
2)Right click on the database, you will get a context menu.
3)Choose "New database" .An interface will be open.
4)Put your database name, set the physical path of your database files ".mdf" and ".ldf" and click on "Ok " button, you will see in New database has been created.
Another way to create database by writing SQL script. Go to SQL server management studio, open a "New Query" widow, write a script to create database and execute statement. You will see a New database has been created.
CREATE DATABASE Turorial
You should keep in mind, database name should be unique in a server. You cannot create database with same name in the same server. There are several option during database creation from both management Studio and script. You can set permissions, physical file configuration and path setting, database file size setting a ect.
Create Database from Existing file.
You can create database, if you have database physical file.
"mdf" , "ldf" are physical file of sql server database.You can restore with the two files.
Here is a example
1)Go to SQL server management studio, open a "New Query" widow, write script, change your file path
Create Database from Interface:
1)Go to SQL server management Studio , you will see the database.
2)Right click on the database, you will get a context menu.
3)Choose "New database" .An interface will be open.
4)Put your database name, set the physical path of your database files ".mdf" and ".ldf" and click on "Ok " button, you will see in New database has been created.
Create Database from SQL Script:
Another way to create database by writing SQL script. Go to SQL server management studio, open a "New Query" widow, write a script to create database and execute statement. You will see a New database has been created.
CREATE DATABASE Turorial
You should keep in mind, database name should be unique in a server. You cannot create database with same name in the same server. There are several option during database creation from both management Studio and script. You can set permissions, physical file configuration and path setting, database file size setting a ect.
Create Database from Existing file.
You can create database, if you have database physical file.
"mdf" , "ldf" are physical file of sql server database.You can restore with the two files.
Here is a example
1)Go to SQL server management studio, open a "New Query" widow, write script, change your file path
CREATE
DATABASE
Tutorial
ON
(
FILENAME
=
'C:\my_file_path\Microsoft
SQL Server\MSSQL11.SQLEXPRESS\MSSQL\DATA\Tutorial.mdf'
)
LOG
ON
(
FILENAME
=
'C:\my_file_path\Microsoft
SQL Server\MSSQL11.SQLEXPRESS\MSSQL\DATA\Tutorial.ldf')
GO
2) execute statement
No comments:
Post a Comment