SQL Server copies the tables in the database to another database

Source: Internet
Author: User

mentioned above:

Article from Baidu Experience

Operation:

In the process of using SQL Server, we may need to copy the table from one database to another, and today we will introduce the specific methods and steps for this operation.

Duplicate table structure
    1. 1

      First, open and connect to SQL Server, right-click the source database source_db (the source database name), and then tap "Write table script" → "Create to" → "New Query Editor window".

    2. 2

      Press "Crtl+a" in the editor generated by the 1th step to select all the contents, then right-click "Copy" (or press "Crtl+c" key).

    3. 3

      Create a new query, then right-paste (or CTRL + V), and change the source_db (source database name) in your code to TARGET_DB (the target database name). Then right-click Execute to execute the code.

    4. 4

      You can then see the tables that were copied in the table structure of the target database.

      END
Data content replication for tables
    1. Select the target database target_db, then click "Tasks" → "Import data".

    2. Go to the SQL Server Import and Export Wizard and follow the instructions.

    3. Select a data source (source database).

    4. Select target (target database), specify table copy, or query.

    5. Select source table and Source view: After you set the source and destination tables, click the Edit Mappings button and select Enable Identity insertion in the pop-up window. (Otherwise an error will occur later)

    6. Always click "Next" to finalize the operation.

SQL Server copies the tables in the database to another database

Related Article

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.