BCP command usage in SQL Server

Source: Internet
Author: User
Tags bulk insert ssis

the bcp command-line Utility

You use the bcp (Bulk copy program) tool to address the bulk movement of data. This utility was bidirectional, allowing for the movement of data into and out of a SQL Server database.

BCP uses the following syntax:

bcp [database_name.] Schema. {table_name | view_name | "Query" { in
data_file | out data_file | queryout data_file | format nul}
[-A packet_size] [-B batch_size] [-c]
[-C {ACP | OEM | RAW | Code_page}]
[-D database_name] [-e Err_file] [-e]
[- F Format_file] [-F First_row] [-h] hint [,... n] "]
[-I input_file] [-K] [-K application_intent]
[- L last_row] [-M max_errors] [-n]
[-n] [-O output_file]
[-p password] [-Q] [-R Row_term]
[-R] [-S [Server_name[\instance_name]]
[-t field_term] [-t] [-u login_id]
[ -v] [-V (| |)] [-W]
[-X]
/?

Some of the commonly used options-other than the ones used to specify the database, such as user ID, password, and so on-a Re the–f and–l options. These options specify the first and last row of data to be loaded from a file, which are especially helpful in Large batches. The–t option allows you to specify the field terminator this separates data elements in an ASCII file. The–e option allows you-import data into SQL Server fields is defined with identity properties.

Tip

The BULK INSERT T-SQL statement and SSIS is good alternatives to bcp. The BULK INSERT statement is limited-loading data into SQL Server, but it's an extremely fast tool for loading data. SSIS is a sophisticated GUI this allows for both data import and data export, and it have capabilities that go well beyond Bcp.

BCP command usage in SQL Server

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.