Harsh Shah
Harsh Shah

Reputation: 188

Import & export database with all data in SQL Server Management Studio

I need to import a SQL Server database from SQL Server Management Studio. I'm using SSMS 18 for both the end.

I want to export the whole database with all tables, columns, data and import with same. I tried few ways but that didn't help me.

Hope will get better solution with understandable steps.

Thank you.

Upvotes: 1

Views: 4719

Answers (1)

Iman Kazemi
Iman Kazemi

Reputation: 552

As Panagiotis Kanavos said, it's better to take a backup and restore it. Sometimes because of version difference it can't be done. So the other way is generating scripts of all objects and data.

Follow below steps:

Step 1: Open SQL Server Management Studio (SSMS).

Step 2: Select the database to script.

Step 3: Right-click on the database and select Tasks > Generate Scripts.

Step 4: On the Choose Objects page, leave the default selection of ’Script entire database and all database objects’ selected

Step 5: On the ’Specify how scripts should be saved or published’ page, click the Advanced button

Step 6: The last selection in the General properties group is ’Types of data to script’, change this to ’Schema and data’

Step 7: If you know you are sending this to someone with an older SQL Server version, you can change the ’Script for Server Version’ property to the Server version you need.

Step 8: If you have triggers in your database, set 'Script Trigger' property true.

Step 9: Click Ok.

Step 10: Change the file location or wherever you want to script to be generated.

Step 11: Click Next, the Next again. At this point, the script will be generated.

Thanks to Dennis Piccioni

Upvotes: 4

Related Questions