我正在尝试使用带有链接服务器的OPENQUERY将数据从SQL Server导入到mysql。
我已经导入了几个表但是我遇到了一个有一个长varchar字段的表的问题。
每次运行此查询时,我都会得到以下内容Msg 7344, Level 16, State 1, Line 2
The OLE DB provider "MSDASQL" for linked server "Serv1" could not INSERT INTO table "[MSDASQL]" because of column "Notes". Could not convert the data value due to reasons other than sign mismatch or overflow.
列Notes在SQL servr中的类型为varchar(8000),在MySQL中也是varchar(8000)。
问题是什么?为什么它给我这个错误?不是我先尝试将varchar(8000)的注释放在首位但是没有用。
INSERT OPENQUERY (Serv1, 'SELECT
id,
i3_identity,
mid,
Notes,
Comments,
result_code,
Disposition,
completed_on,
calltype
FROM finaltesting.activities')
SELECT
CAST(ID AS int) AS id,
CAST(identity AS int) AS identity,
CAST(merchantAccount AS varchar(255)) AS mid,
Notes,
CAST(Comments AS varchar(8000)) AS Comments,
CAST(FinishCode AS varchar(255)) AS result_code,
CAST(Disposition AS varchar(255)) AS Disposition,
CAST(callDate AS datetime) AS completed_on,
CAST(CallType AS varchar(255)) AS calltype
FROM activities
由于符号不匹配或溢出以外的原因,无法转换数据值。
答案 0 :(得分:0)
我能够通过将MySQL中的列类型从varchar(8000)更改为Text来解决此问题。我使用的是MySQL 5.6.12。将表单SQL Server转换为MySQL服务器时,可能是列类型问题。
由于