SQL Server data Import Export tool bcp use detailed

Source: Internet
Author: User

BCP is a command-line tool in SQL Server that is responsible for importing exported data, is based on db-library, and can efficiently import and export large quantities of data in a parallel manner. This article describes how to import export data using bcp.

BCP is a command-line tool in SQL Server that is responsible for importing exported data, is based on db-library, and can efficiently import and export large quantities of data in a parallel manner. BCP can export a table or view of a database directly, or it can filter the table or view through a select from statement. When you import export data, you can use default values or use a format file to import data from a file into a database or to export data from a database to a file.

The following is a detailed discussion of how to import export data using bcp.

1. Introduction to main parameters of BCP

BCP has a total of four actions to choose from.

(1) Import.

This action is done using the in command followed by the name of the file you want to import.

(2) export.

This action is done using the Out command followed by the name of the file you want to export.

(3) Export using SQL statements.

This action is done using the Queryout command, which is similar to out, except that the data source is not a table or view name, but rather an SQL statement.

(4) Export the format file.

This action is done using the Format command, followed by the file name.

The following are some common options:

-F Format_file

Format_file represents the format file name. This option depends on the action described above, if you are using in or Out,format_file to indicate a format file that already exists, and if you are using format, it means the file you want to generate.

-X

This option is used in conjunction with-F format_file to generate XML-formatted format files.

-F First_row

Specifies which row from the exported table is exported, or from which line of the file being imported.

-L Last_row

Specifies which line to end when the exported table is to be directed to, or from the file being imported.

-C

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.