Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of default coding garbled when MsSQ data is imported into Mongo

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains how to solve the problem of default coding garbled when MsSQ data is imported into Mongo. Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to solve the problem of default coding garbled when importing MsSQ data into Mongo.

Let's talk about the steps of my operation first.

Query 50, 000 pieces of data from sql2008's management studio and right-click to export to csv

Since the default export does not have a column name, the column name is added after manual editing

Import data using mongoimport, error, prompt invalid utf8 character

Checked, because the default export to csv, not the utf8 format but the system default coding, using openoffice editing and saving as utf8 format can solve the coding problem, but found that column names and data do not match after the use of openoffice, many column names are stacked together, although the data can be imported, but can not be used at all.

In a different way, instead of exporting csv, copy the data directly to excel and save it as csv. Everything is fine. A strange problem arises here. The encoding used here is still the default system code. Why not prompt an error?

Since manual conversion to csv is possible when the amount of data is small, but it is slow to edit when the amount of data is large, it is configured in mangement studio. Option-query results-sql server- displays the results in a grid, select "include column headings when copying or saving results" so that when using export to csv, the default is with the column name.

The copy code is as follows: mongoimport-d local-c testtable-- type csv-- headerline-- file c:\ inmongo.csv

Just go straight.

At this point, I believe that everyone on the "MsSQ data imported into Mongo default coding garbled problem how to solve" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report