Large data import and export-tool BCP

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 entire table currency or view of the sample database adventureworks and use SQL to connect to BCP adventureworks. sales. currency out C: currency1.txt-c-u "sa"-P "password" -- use SQL connection Example 2: Same as above, use 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 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

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/zhou__zhou/archive/2007/08/10/1736310.aspx

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.