【问题标题】:INSERT INTO query returning "Unclosed quotation mark after the character string"INSERT INTO 查询返回“字符串后的未闭合引号”
【发布时间】:2013-07-01 19:25:43
【问题描述】:

我尝试在网站和 Microsoft 文档中到处查看,但我一直在运行查询以将对象插入我的表中。我做错了什么来获取

"字符串'cate'后面的非右引号"

错误?

这里是查询:

INSERT INTO t_lu_Product ([product_id], [description], [isCompetition], [category], 
                          [subCategory], [brand], [type], [returnability], [capacity]) 
VALUES(200011073, '1.25L PNR CC', 1, 'Cola',
       'Cola Regular', 'Coca-Cola', 'Familiares', 'No Retornable', 1);

【问题讨论】:

  • 您确定是 exact 查询导致了错误吗?
  • 我已经编辑了你的标题。请参阅“Should questions include “tags” in their titles?”,其中的共识是“不,他们不应该”。
  • 这是您唯一执行的操作吗?错误可能来自此查询之前或之后的代码吗?
  • 是的,我直接从与数据库交互的命令行控制台数据库浏览器运行此查询。这是一个独立的查询
  • 感谢您的编辑,约翰!

标签: sql sql-server


【解决方案1】:

我猜您尝试插入的字符串之一有一个撇号。根据您创建查询的方式,您可以使用参数或转义撇号:

INSERT INTO t_lu_Product ( ... ) VALUES(... ,'Mother''s Cookies',1);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-04-22
    • 1970-01-01
    • 2021-07-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多