BCP large data import and export tool

Source: Internet
Author: User

For more information about the parameters of the BCP tool, see books online.
This section describes how to use the following four examples: Export (out), import (in), query and export (queryout), and export and format (-f) files.
Example 1: export the sample databaseAdventureworksEntire tableCurrencyOr view, use SQL to connect

BCP adventureworks. Sales. Currency out c: \ currency1.txt - C - U "sa" - P "password" -- Connect using SQL

Example 2: connect with a trusted connection.

BCP adventureworks. Sales. Currency out c: \ currency1.txt - C - T -- Use trusted connection

Example 3: import data

BCP adventureworks. Sales. currency1 In C: \ currency1.txt - C - T

Or import 10-13 rows of the specified data

BCP adventureworks. Sales. currency1 In C: \ currency1.txt - C - F 10 - L 13   - T

Example 4: Use query to export data

BCP" Select   Top   20   *   From Adventureworks. Sales. Currency "queryout c: \ currency2.txt - F 10 - L 13 - C - U "sa" - P "password" - S "ip"

Or

BCP" Select   Top 4 *   From Adventureworks. Sales. Currency Where ID Not   In ( Select   Top 9 ID From Adventureworks. Sales. Currency "queryout c: \ currency2.txt - C - U "sa" - P "password" - S "ip"

Example 5: export a formatted file:

Exec Master .. xp_mongoshell ' BCP adventureworks. Sales. Currency format NUL-f c: \ currency_format1.fmt-c-t

Finally: The above is the BCP tool of the client, you can also use the BCP of the server from the client

Exec Master .. xp_mongoshell ' BCP "select top 20 * From adventureworks. Sales. Currency" queryout c: \ cur.txt-f 10-L 13-c-t

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.