SQL Server2012 How to export SQL scripts and restore the database

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.