【问题标题】:Excel ODBC SQL Statement Throwing Error '[ODBC EXCEL Driver] Data Type Mismatch in criteriaExcel ODBC SQL 语句抛出错误'[ODBC EXCEL 驱动程序] 条件中的数据类型不匹配
【发布时间】: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)"**

【问题讨论】:

    标签: sql excel odbc


    【解决方案1】:

    感谢那些看到这个的人,但我似乎找到了答案。

    之前有一个 insert into 语句将数据加载到表中,一旦将数据加载到其中,表会将数字存储为文本而不是整数。在删除行并确保列的格式设置为整数后,SQL 查询开始按预期运行。

    【讨论】:

      猜你喜欢
      • 2011-06-21
      • 1970-01-01
      • 2019-07-30
      • 2018-03-24
      • 1970-01-01
      • 2016-01-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多