Default encoding of MsSQL data imported to Mongo (correct method for importing Mongo)

Source: Internet
Author: User

Let's talk about the procedure.
1. query 50 thousand pieces of data from management studio of sql2008, right-click to export to csv
2. Because no column name is exported by default, the column name is added after manual editing.
3. The error message "invalid utf8 character" is returned when data is imported using volume import.


After checking, it is because when the default export is csv, it is not in utf8 format but the default encoding of the system. You can solve the encoding problem by saving openoffice editing to utf8 format, however, we found that the column names and data after using openoffice do not match, and many column names are stacked together. Although the data can be imported, it cannot be used at all.

Another way is to copy the data directly to excel and save it as csv without exporting the csv file. Everything works normally, and a strange problem occurs here, the encoding used here is the default system encoding. Why is no error prompted?

Manual conversion to csv can be performed when the data volume is small, but the editing speed is slow when the data volume is large, so you can configure it in mangement studio.
Option-query result-SQL server-display results in a grid and select "include column title when copying or saving results"
In this way, when exported as csv is used, the column name is taken by default.

Copy codeThe Code is as follows:
Export Import-d local-c testtable -- type csv -- headerline -- file c: \ in1_.csv

You can do it directly.

 

However, this encoding problem is very strange. I don't know if someone knows it in depth.

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.