Default encoding problem for imported MSSQL data to MONGO (MONGO method is correctly imported) _mssql

Source: Internet
Author: User
Tags mssql management studio

First of all, I do the steps.
1. Query 50,000 data from SQL2008 's management Studio, using the right key to export to CSV
2. Since the default export has no column name, the column name is added after manual editing
3. Use Mongoimport to import data, error, hint invalid UTF8 character


Check, because the default export to CSV, not UTF8 format but the system's default encoding, using OpenOffice Edit Save as UTF8 format can solve the coding problem, but found that the use of OpenOffice after the column name and data mismatch, column names are stacked together, Although the data can be imported, it is not available at all.

Another approach, do not use the export CSV, direct copy data to Excel and then save as a CSV, all normal, here is a very strange problem, here is the use of the code or the default system code, why not prompt error?

As a result of manual conversion to CSV in the amount of data can be, but when the volume of large data editing is slow, in Mangement studio configured a little bit.
Options-Query Results-sql server-to display results in a grid, select include column headings when copying or saving results
This way, when you use Export to CSV, the default is with the column name.

Copy Code code as follows:

mongoimport-d local-c testtable--type csv--headerline--file c:\inmongo.csv

Just go straight.

But the problem with the coding is so strange that no one knows for sure.

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.