- Courses
- Tutorials
- Jobs
- Practice
- Contests
How to Import and Export SQL Server Database?
SQL Server is very popular in Relational Database and it is used across many software industries. In MS SQL Server, two sorts of databases are available.
- System databases
- User Databases
In this, we will learn to export and import SQL Server databases using Microsoft SQL Server. Exporting and Importing stands as a backup plan for developers.
Step 1: Open the “Microsoft SQL Server” Click on “File”, “New” and select “Database Engine Query”.
Step 2: Create a Database
Query :
CREATE DATABASE college;
Output:

Step 3: Select the newly created table “college”.
Query :
USE college;
Output:

Step 4: Creating a Table
Query :
CREATE TABLE students( id INT NOT NULL PRIMARY KEY, name VARCHAR(300) NOT NULL , reg _no INT NOT NULL , semester INT NOT NULL );
Output:

Step 5: Insert the Records
Query :
INSERT INTO students VALUES (1,'priya',31,3),(2,'keerthi',12,1), (3,'rahul',29,2),(4,'reyansh',38,3), 5,'lasya',47,2);
Output:

Exporting SQL Server Database:
After creating a database in “Microsoft SQL Server”, Let’s see how exporting takes place.
Step 1: Open the Object Explorer, Right-click on the Database that you want to export and click the “task” option and select “Export Data-Tier Application”.

Step 2: Click Next and by browsing, select the destination folder in which you have to save the database file. The filename should be as same as the database name ( here “college” ) and click “Next ” and “Finish”. You will get a dialogue box showing the result of exporting.

Importing SQL Server Database :
Step 1: Right Click on the Database folder and select “Import Data-Tier Application” and click “Next.

Step 2: Select the file which you have exported and change the name of the database

here we changed the database name from “college” to “college_ info” and click “Next” and a dialogue box appears showing the result of importing.

Start Your Coding Journey Now!
Register




