简体   繁体   English

SQL 服务器迁移助手 (SSMA):错误 [22018] [MySQL][ODBC 5.3(a) 驱动程序][mysqld-5.1.51-社区]

[英]SQL Server Migration Assistant (SSMA): ERROR [22018] [MySQL][ODBC 5.3(a) Driver][mysqld-5.1.51-community]

I am using SSMA for MySQL to migrate from MySQL to MSSQL and on several tables I am getting the 22018 error.我正在为 MySQL 使用 SSMA 从 MySQL 迁移到 MSSQL,在几个表上我收到 22018 错误。 After lots of mucking about I found that the error was being generated due to Russian characters being stored in these tables.经过大量研究后,我发现错误是由于这些表中存储了俄语字符而产生的。

For example: Бухгалтерский учет例如: Бухгалтерский учет

There are other non-English characters in the tables, such as Profissão Jurídica and they are coming through OK.表格中还有其他非英语字符,例如Profissão Jurídica ,它们通过了 OK。

The error is to do with collation and the collation on the MySQL table is latin1_swedish_ci and the column that holds the "foreign" characters has utf8_unicode_ci collation on it and is a varchar(255) .错误与排序规则有关,MySQL 表上的排序规则是latin1_swedish_ci并且包含“外来”字符的列具有utf8_unicode_ci排序规则并且是varchar(255)

The recipient table in MSSQL uses the database default collation ( Latin1_General_CI_AS ) and the recipient column is a nvarchar(255) . MSSQL 中的收件人表使用数据库默认排序规则 ( Latin1_General_CI_AS ),收件人列是nvarchar(255)

In SSMA the charset mapping for latin1 is set to the default of CHAR/VARCHAR and I have tried having this set to NCHAR/NVARCHAR with no success.在 SSMA 中, latin1字符集映射设置为默认的CHAR/VARCHAR ,我尝试将其设置为NCHAR/NVARCHAR但没有成功。 The type mapping for varchar is set to nvarchar for all instances.对于所有实例, varchar类型映射都设置为nvarchar

The only thing close to an answer that I have found is this posting .我找到的唯一接近答案的是这篇文章 Unless I'm missing the point of the answer, I can't see that there is a missing conversion - or is there?除非我错过了答案的要点,否则我看不到缺少转换 - 或者是吗?

After having spent literally hours trying to find out why it didn't work I found the solution when I started to give up and use a linked table in Access to the then a pass-through query into MSSQL. 在花了数小时的时间试图找出为什么它不起作用后,我开始放弃并使用Access中的链接表,然后对MSSQL进行传递查询时找到了解决方案。

I was using the wrong ODBC driver. 我使用了错误的ODBC驱动程序。 It turns out there are 2 MySQL ODBC drivers installed an ANSI and a Unicode driver. 事实证明,有2个MySQL ODBC驱动程序安装了ANSIUnicode驱动程序。 I was using ANSI . 我正在使用ANSI When I swapped it to Unicode all was well! 当我将其交换为Unicode一切都很好!

Unicode ODBC驱动程序

As per the Microsoft SSMA help guide SSMA is compatible with only MySQL ODBC 5.1 Driver (trusted). 根据Microsoft SSMA帮助指南,SSMA仅与MySQL ODBC 5.1驱动程序兼容(受信任)。

I downgraded MYSQL ODBC from 5.3 to 5.1 and it worked. 我将MYSQL ODBC从5.3降级到5.1,并且可以正常工作。

MYSQL ODBC 5.1~ link https://dev.mysql.com/downloads/file/?id=415029 MYSQL ODBC 5.1〜链接https://dev.mysql.com/downloads/file/?id=415029

在此处输入图片说明

When I changed the driver type from ANSI to Unicode it worked for me.当我将驱动程序类型从 ANSI 更改为 Unicode 时,它对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM