How to export the schema and the data of an MSSQL-DB into an .sql script
One way to make a back-up file of your MSSQL Database is by exporting its schema, and optionally its data, into a new .sql script. The script can be automatically generated via the MSSQL Management Studio tool. Here is how:
-
Right click on the Database you want to export and click on the Tasks -> Generate Scripts option
-
You can either export the entire database of parts of it. Click on Next after you decide which objects you want to export
-
If you want to export not only the schema for each table but also its data, then click on the Advanced button and then on the Types of data to script select the Schema and data option:
-
Click the Next button twice and wait for the generation of the script to complete
I hope this will help some of you guys.