【发布时间】:2015-04-21 12:53:47
【问题描述】:
下面的 SQL 语句将值插入到新表中的新工作表 (TempPoints) 中。如果我删除语句的最后一部分(粗体),查询运行正常,但是当我将其添加回语句时,我会收到以下错误消息; '[ODBC EXCEL 驱动程序] 标准中的数据类型不匹配'。
我已经在 SQLServer 中复制了表和查询,它运行正常并且符合预期,这证明完整的语句是正常的。这是 Excel ODBC 驱动程序的限制吗??
提前谢谢你。
strSQL = "INSERT INTO [TempPoints$] (REFP, PointItemRef, LoadItemRef, PointDES, Iotype, Subtype, Notes) " & _
"SELECT " & tempref & ", [PointsDB$].ItemRef, [LoadstoPointsDB$].LoadRef, [PointsDB$].PointDES, [PointsDB$].Iotype, [PointsDB$].Subtype, [PointsDB$].Notes " & _
"FROM [LoadsToPointsDB$] INNER JOIN [PointsDB$] ON [LoadsToPointsDB$].PointRef = [PointsDB$].ItemRef " & _
"WHERE [LoadsToPointsDB$].LoadRef = " & moditemref & " AND [PointsDB$].SystemComp = 'Y' " & _
**"AND NOT EXISTS (SELECT * FROM [TempPoints$] WHERE [TempPoints$].PointItemRef = [PointsDB$].ItemRef)"**
【问题讨论】: