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.