在MySQL中插入INTO错误

时间:2010-03-11 14:31:51

标签: mysql

Notice: You have an error in your SQL syntax; 
        check the manual that corresponds to your MySQL server 
        version for the right syntax to use near 
'usage VALUES('16','143','ew','weff','25-3-2010','8.00 AM','22-3-2010','10.00 AM''

at line 1 in:

INSERT INTO usage 
VALUES('16'
      ,'143'
      ,'ew'
      ,'weff'
      ,'25-3-2010'
      ,'8.00 AM'
      ,'22-3-2010'
      ,'10.00 AM'
      ,'wfsdc'
      , '34'
      ,' frsdfr '
      ,'TEST 1'
      ,'ISMAIL SALLEH'
      ,'efsdc'
  )

我不知道错误出在哪里......我正盯着它看了2个小时,但实际上找不到错误。

2 个答案:

答案 0 :(得分:6)

尝试:

INSERT INTO `usage` VALUES ....

您只需要wrap the table name in backticks,因为USAGE是MySQL中的保留字。

来源:MySQL Docs: Reserved Words

答案 1 :(得分:0)

你是否尝试过从头开始重新输入,以防你使用剪切和粘贴将行放在一起,并且可能意外地包含了一个不可见的控制字符,这会使SQL解析器窒息......?