Bulk Import and export data--bcp utility

Source: Internet
Author: User

Bulk Import and export data--bcp utility

Role


The bcp utility can bulk copy data between a SQL Server instance and a data file in a user-specified format .

You can use the bcp utility to import a large number of new rows into a SQL Server table, or to export table data to a data file.

Unless used with the queryout option, you do not need to know the Transact-SQL knowledge to use the utility.

To import data into a table, you must use a format file created for the table, or you must understand the structure of the table and the data types that are valid for the columns in the table.

Attention:

If you use bcp to back up your data, create a format file to record the data format. BCP data files do not include any schema or format information, so if you have deleted a table or view and you do not have a format file, you may not be able to import data.


Experience talk

The data format used for bulk import or export directly affects the accuracy of importing or exporting data. BCP uses the character format-c parameter to import or export data, allowing it to automatically transform for simple data retrieval. But in fact, many data types will be truncated, garbled and so on after the conversion. Creating a format file is the best way to guarantee the accuracy of exporting or importing data. Of course, if you understand the structure and data type of a table, you can choose the appropriate application scenario between native (database) format, character format, Unicode native format, Unicode character formatting, and enter the correct parameters.

Reference:

Https://msdn.microsoft.com/zh-cn/library/ms162802.aspx

This article is from the SQL Server deep dives blog, so be sure to keep this source http://ultrasql.blog.51cto.com/9591438/1628038

Bulk Import and export data--bcp utility

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.