【问题标题】:Access into insert Error: Entering number into Access number field访问插入错误:在访问号码字段中输入号码
【发布时间】:2013-03-12 15:38:39
【问题描述】:

我使用 Access 数据库编写了一个 java 程序,我可以记录字符串值,但是我使用数字字段列为数字值编写的查询会生成 INSERT INTO 错误。以下是查询和错误。

Level - Col in table with number field

Access Insert Statement:
INSERT INTO SystemEquipment(Level) Values (12);

Error:
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.

**Tried to run the query with and without single quotes and semicolons

【问题讨论】:

    标签: sql ms-access sql-insert


    【解决方案1】:

    因为LEVEL 是保留关键字。您必须使用 [] 转义它

    INSERT INTO SystemEquipment([Level]) Values (12);
    

    来自 MS Access Docs,

    如果保留字已被使用,您可以通过以下方式避免错误消息 用括号 ([]) 将每个出现的单词括起来。然而, 最好的解决办法是把名字改成非保留字。

    【讨论】:

      猜你喜欢
      • 2012-07-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-21
      • 1970-01-01
      • 1970-01-01
      • 2023-03-03
      • 2013-04-12
      相关资源
      最近更新 更多