当前位置: 首页 > 知识库问答 >
问题:

错误:ER_PARSE_ERROR:SQL语法中有错误;请查看与MySQL server版本相对应的手册

禄仲渊
2023-03-14

我正在尝试使用从NPM下载的“MySQL”模块将一些数据从节点JS发送到MySQL。

connection.beginTransaction(function(err) {
        if (err) { throw err }
        connection.query(sq, function (error, result) {
              if (error) {
            //return connection.rollback(function() {
            throw err
          //})
          } else {
            console.log('data is inserted ... ' + new Date())
          }
        })

我的查询,即sq,就是这样的东西…

INSERT INTO archlb_sales(fiscalYear, fiscalQuarterID, fiscalPeriodID, fiscalWeekID, geo, theater, area, operation, region, country, salesAgen
tName, emailID, arch, technology, subTechnology, tms3, productFamily, scms, totalSales, agentType, salesAgentnumber, softBookingsNet) values ('
2017', '2017Q1', '201701', '2017014', 'Americas', 'Americas-MISCL2', 'Americas-MISCL3', 'Americas-MISCL4', 'Americas-MISCL5', 'UNKNOWN', 'G2C A
djustment Agent', 'UNKNOWN' , 'Collaboration' , 'Collaboration','CLOUD SW' , 'CLD-AUDIO-SW' , 'CWAU', 'OTHER' , -205, 'TEAM AGENT', 'UNKNOWN' ,
 '1') ON DUPLICATE KEY UPDATE totalSales = totalSales + -205;

INSERT INTO archlb_sales(fiscalYear, fiscalQuarterID, fiscalPeriodID, fiscalWeekID, geo, theater, area, operation, region, country, sal
esAgentName, emailID, arch, technology, subTechnology, tms3, productFamily, scms, totalSales, agentType, salesAgentnumber, softBookingsNet) val
ues ('2017', '2017Q1', '201701', '2017014', 'Americas', 'Americas-MISCL2', 'Americas-MISCL3', 'Americas-MISCL4', 'Americas-MISCL5', 'UNKNOWN',
'G2C Adjustment Agent', 'UNKNOWN' , 'Collaboration' , 'Collaboration','CLOUD SW' , 'CLD-AUDIO-SW' , 'CWAUCC', 'OTHER' , -123, 'TEAM AGENT', 'UN
KNOWN' , '1') ON DUPLICATE KEY UPDATE totalSales = totalSales + -123;

这些变量的值是从一个文本文件中读取的,它们是正确的

MySQL给出以下错误。

Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the ri
ght syntax to use near \'INSERT INTO archlb_sales(fiscalYear, fiscalQuarterID, fiscalPeriodID, fiscalWeek\' at line 3

这是表架构:

共有1个答案

巫懿轩
2023-03-14

您试图在一个查询中执行多条SQL语句,除非您显式地设置 选项,否则将禁用该查询。

 类似资料: