SQL database import and export statement

Source: Internet
Author: User

It briefly records how to use the BCP tool to import and export data. BCP is a tool that comes with SQL server, so you only need to install it. Enter cmd in cmd and you will find some of its parameter description options. You can check the specific parameter options when using them. I will not explain them here (in fact, I do not use them too much ^_^)

 
A simple export example:
If you have Database A with Table B, the command for exporting data from database B is as follows:
   
The code is as follows: Copy code
Bcp a .. B Out C: Currency1.txt- C-U "sa"-p "123456"
 
Note that there are two items in the middle of A and B. If you use inheritance verification, you can remove the-u-p option and change it to-t. The following figure shows the screenshot that I executed:
 
 
To import exported data, run the following command:
 
The code is as follows: Copy code
Bcp a .. B In C: Currency1.txt- C-U "sa"-P "123456"
 
We can see that the only difference from the export is that the out is replaced with in. So far, the most concise SQL server data import and export records have been completed

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.