簡體   English   中英

INSERT INTO 語法錯誤 SQL

[英]INSERT INTO syntax error SQL

我不知道為什么我會收到這個錯誤。 這可能是我在語法中看不到的東西,因此將不勝感激。

陳述

INSERT INTO pwd_review (id, request_date, being_reviewed, review_explain, 
                        attached_docs, doc_explain, age_met, age_explain, 
                        years_met, years_explain, severity, severity_explain, 
                        restriction, restriction_explain, require, require_explain) 
VALUES(410, DATE '2009-12-10', 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0,
       'Dr M Beaulieu has provided further information indicating that applicant is severly ill and disabled. Applican''t condition is confirmed as rectal adenocarcinoma, she has endured dhemo and readiation therapy and is under care of the Oncology Team, surgeon and GP.', 0,
       'Information from Dr states that applicant is unable to sit, has great difficulty walking and requires ongoing support from the Community Support Services',
       0, NULL);

錯誤

1064 - 您的 SQL 語法有錯誤; 檢查手冊

that corresponds to your MySQL server version for the right syntax to use near 'require,require_explain) VALUES(410,DATE '2009-12-10',0,NULL,0,NULL,0,NULL,0,NUL' at line 1

謝謝。

REQUIRE保留的 MySQL 關鍵字 您必須將其括在反引號中,如下所示:

`require`

此外,值得指出的是 MySQL 使用反斜杠轉義單引號,而不是像 SQL Server 和 Access 這樣的兩個單引號。 如果上面是您的確切 SQL 語句並且該單引號未被轉義,則此短語可能會出現問題:

Applican''t condition

這是因為“require”是一個關鍵字反引號它。

我將您的查詢復制粘貼到 MySQL Workbench,您似乎正在使用保留的require關鍵字作為表列的名稱,以解決該問題:

INSERT INTO pwd_review (id, request_date, being_reviewed, review_explain, 
                        attached_docs, doc_explain, age_met, age_explain, 
                        years_met, years_explain, severity, severity_explain, 
                        restriction, restriction_explain, `require`, require_explain) 
VALUES(410, DATE '2009-12-10', 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0,
       'Dr M Beaulieu has provided further information indicating that applicant is severly ill and disabled. Applican''t condition is confirmed as rectal adenocarcinoma, she has endured dhemo and readiation therapy and is under care of the Oncology Team, surgeon and GP.', 0,
       'Information from Dr states that applicant is unable to sit, has great difficulty walking and requires ongoing support from the Community Support Services',
       0, NULL);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM