1

I have a table in SQL server that I want to move to a MySQL table. However, I want to change the default encoding from latin-1 to utf-8. I've tried running the SQL Server Import and Export Wizard, which exports a csv to a file. It fails when I select a utf-8 encoding for the "Code page". It is stored as latin-1.

Anyway, I was wondering how I could export this data and import it into MySQL as utf-8? I do not want to open a text-editor and save the exported file as UTF-8.

3
  • 1
    Which wizard? Does the export wizard create a file? What does the file look like? How is the import performed? Commented Sep 1, 2015 at 1:02
  • SHOW CREATE TABLE and SELECT col, HEX(col) FROM tbl WHERE ... for some small sample. That way, we can see if it is utf16 or something else. Commented Sep 1, 2015 at 1:03
  • The SQL Server Import and Export Wizard. So I right click a database and can select Tasks>Export data to start it up. I ran the SHOW CREATE TABLE and received a SQL_Latin1_General_CP1_CI_AS encoding. Commented Sep 1, 2015 at 16:00

1 Answer 1

1

Plan A:

Continue to export as SQL_Latin1_General_CP1_CI_AS, but be sure to set up the import as CHARACTER SET utf8.

However, this may tricky if the CREATE TABLE statements are buried in the dump. So...

Plan B:

Export and Import as currently being done. Then, for each table, do

ALTER TABLE tbl CONVERT TO CHARACTER SET utf8;

If you plan to handle Chinese, utf8mb4 would be better.
For many uses, the default COLLATE utf8_general_ci is fine, but you could consider utf8_unicode_ci.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.