The SQL Server export and import methods are as follows:

Source: Internet
Author: User

SQL Server exports and imports data in the following ways:

    1. The import and export interface is provided in SQL Server.
    2. The interface operation is divided into two modes: Copy data of one or more tables or views, and write query to specify the data to be transmitted, the first is to export all fields and records in tables and views, and the second is to control the exported fields and rows through SQL statements.
    3. UseSimple but useful SQL scriptsTable replication in.
    4. Another way is to use the BCP command in the command line to import and export data. Note that this is a good way to import and export large data volumes.
 --  Export the entire table (out) BCP database name. DBO. Table name out c: \ currency.txt - S "database instance" - U "user" - P "password" -  C  -- Export using SQL statements (queryout) BCP" Select   *   From Database Name. DBO. Table Name "queryout c: \ currency.txt - S database instance - U "user" - P "password" -  C  --  Set the field separator and line separator (-c-t ","-R "\ n"). If you do not want to enter the field type, use it with-C. BCP" Select   *   From Database Name. DBO. Table Name "queryout c: \ currency.txt - S database instance - U "user" - P "password" - C - T "," -  R "\ n"  --  Specify the number of lines of imported data per batch, and the number of bytes of each network packet sent or received by the server (-K-b5000-a65535) BCP" Select   *   From Database Name. DBO. Table Name "queryout c: \ currency.txt - S database instance- U "user" - P "password" - C - T "," - R "\ n" - K - B5000 -  A65535  --  Execute on the query analyzer (Exec master.. xp_mongoshell)  Exec Master .. xp_mongoshell ' BCP "select * from database name. DBO. Table Name" queryout c: \ currency.txt-s database instance-U "user"-P "password"-C  '  --  Generate a. SQL file from the SQL statement and then call  --  Note: The folder name in the path cannot contain spaces.  Exec Master .. xp_mongoshell '  Osql-s database instance-u user-P password-I c: \ mongoshelltest. SQL  '    --  Import data to the currency table  Exec Master .. xp_mongoshell ' BCP database name. DBO. Table Name in c: \ currency.txt-c-t  '  --  You can also use the-F and-l options to select the record rows for data import.  Exec Master .. xp_mongoshell '  BCP database name. DBO. Table Name in c: \ currency.txt-C-f 10-L 13-T  ' 

 

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.