Last introduced how to restore the database file through the Bak file, today to explain how to export SQL script to back up and restore the new database, but this method is more suitable for small and medium-sized database data tables, the following SQL Server2012 as an example to illustrate.
A BACKUP Database
1 Select a database, right-click select: task = = "Generate script;
2 Select the database object to script, note that you can select a specific database object here, we can select the data table we need to back up.
3 under the current page, select the Advanced option in the first step, and then select the location where the output SQL script will be saved.
4 The most important step in the advanced options is to select the first item "Schema and data" in the "data type of script to be written", which defaults to "schema only", which only duplicates the database's table structure and does not replicate the database's specific data.
5 We can view the specific exported scripts and data.
Two-Restore Database
1 Create an identical, empty database in a new DB instance with the name Igis.
2 by: File = = Open the file and open the script file that you just started exporting.
3 Select Execute or press F5 to perform the corresponding operation, you can import the data table structure and data inside the corresponding database into the new database, and finally complete the backup work of the database.
SQL Server2012 How to export SQL scripts and restore the database