How to Import and Export SQL Server Database?
Creating and managing a SQL Server database is an essential skill for database administrators and developers. In this article, We will go through the process of setting up a database in SQL Server, from creating the database and tables to inserting records, and finally, exporting and importing the database for backup or transfer purposes.
Creating and Managing a SQL Server Database
Step 1: Open the "Microsoft SQL Server" Click on "File", and "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:

Steps to Export 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.

Steps to Import 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 we 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.

Conclusion
By following this guide, you have successfully created and managed a SQL Server database, including the steps to export and import the database. These foundational skills are crucial for maintaining and transferring data in SQL Server, ensuring that your databases are well-organized and easily accessible.