问题
I am using Mysql Work bench(6.3) to migrate Database from MS Sql server(2008) to Mysql. It is erroring out during the "bulk Data Transfer" with below warnings. This is happening only with column types like (varchar, char). When I tried table with all 'int' columns there is no issue. Here is the log I got when I tried to migrate "Boy" table with columns (Name(char),age(int),Type(varchar))
> `[WRN][ copytable]: 20 characters could not be converted to UTF-8 from column Name during copy
[WRN][ copytable]: 24 characters could not be converted to UTF-8 from column Type during copy
[INF][ copytable]: Statement execution failed: Data too long for column 'Name' at row 1:
INSERT INTO `Test`.`Boy` (`Name`, `Age`, `Type`) VALUES ('John \0 `Test`.`Boy` (`Name',10,'Type is Lien\0\0\0\0�\�7\0\0\0\0\0\0\0\0\0\0\0\0\0\0d\0\0defperformance_schemasession_variablessession_variables\rVariable_name\rVARIABLE_NAME\0@\0\0\0�\0\0\0]\0\0defperformance_schemasession_variablesse')`
Collation in MSsql is Latin1 and UTF8 in MySQL.
Also, exporting table data in to flat file and importing it in Mysql worked (but this is table to table not bulk transfer) ..
回答1:
Changing the Source connection method from 'ODBC Data Source' to 'ODBC Data Source(Free TDS)' worked. As explained in this link http://www.martin-brennan.com/could-not-successfully-convert-ucs-2-string-to-utf-8/
回答2:
Connection method should be ODBC Data Source(Free TDS) and need to enable 'Driversends Unicode data as UTF-8' in advanced tab.
If you see any Data migration errors like 'Statement execution failed: Incorrect string value: '\xA310 pe...' for column'
Change storage engine INNODB to MYISAM and restart Mysql service
回答3:
I found that I had to do all of the above, yet it still wouldn't migrate just one table. I inspected this table and it contained the mu symbol μ
I removed this rogue character and the migration continued successfully.
回答4:
Just download mysql workbench 6.3.8. It fixed the "Could not successfully convert UCS-2 string to UTF-8" bug when using ODBC(native) for connection method
来源:https://stackoverflow.com/questions/34232203/sql-server-to-mysql-migration-using-mysql-workbench-data-transfer-error