INSERT INTO синтаксическая ошибка SQL - PullRequest
1 голос
/ 17 августа 2011

Я в недоумении, почему я получаю эту ошибку.Это может быть что-то, чего я не вижу в своем синтаксисе, поэтому любая помощь будет принята с благодарностью.

ЗАЯВЛЕНИЕ

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;проверьте руководство

, соответствующее вашей версии сервера MySQL, на предмет правильного синтаксиса для использования рядом с 'require, require_explain) VALUES (410, DATE' 2009-12-10 ', 0, NULL, 0, NULL, 0, NULL, 0, NUL 'в строке 1

Спасибо.

Ответы [ 3 ]

8 голосов
/ 17 августа 2011

REQUIRE является зарезервированным ключевым словом MySQL . Вы должны заключить его в кавычки как:

`require`

Также стоит отметить, что MySQL экранирует одинарные кавычки с обратной косой чертой, а не две одинарные кавычки, такие как SQL Server и Access. Эта фраза может стать проблематичной, если приведенное выше является вашим точным оператором SQL и эта одинарная кавычка не была экранирована:

Applican''t condition
2 голосов
/ 17 августа 2011

потому что "require" - это ключевое слово, обратное ему.

0 голосов
/ 17 августа 2011

Я скопировал ваш запрос в 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);
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...