2011-08-16 13 views
1

このエラーが発生する理由は何ですか?私の構文で見ることができないかもしれないので、どんな助けでも大歓迎です。INSERT INTO構文エラーSQL

STATEMENT

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); 

ERROR

1064 - あなたはあなたのSQL構文でエラーが発生しています。近く 使用する権利構文についてはMySQLサーバのバージョンに対応するマニュアル

をチェックし「必要、require_explain)VALUES(410、DATE '2009-12-10'、0、NULL、0、NULL、0 。、ラインでNULL、0、NULは」1

おかげ

+1

'DATE「は2009-12- 10 'は少しでも見えます。あなたは '' 2009-12-10''で試しましたか? – jadarnel27

+0

私はすべてのインサートにDATEを使用していますが、正常に動作しています。 – Koralarts

+0

私の謝罪は、私はSQLサーバーの構文を考えていた、あなたは明らかにmysql =/ – jadarnel27

答えて

8

REQUIREreserved MySQL keywordであるあなたは、としてバッククォートで囲む必要があります。

`require` 

また、MySQLがSQL ServerやAccessのような二重引用符ではなくバックスラッシュで一重引用符をエスケープすることも指摘しておきましょう。上記のあなたの正確なSQL文であり、その単一引用符をエスケープされていない場合、このフレーズが問題になることがあります。

Applican''t condition 
+1

+1と述べた。なぜ人々はいつも私より速いのですか? ;)私は通常、MySQLの識別子名を逆順に引用することに傷ついていません。 –

+0

'VALUES'セクションのデータをアクセスからエクスポートしました。 – Koralarts

+0

@Datacommieおそらく、 ''''を '\ ''に検索/置換する必要があります –

2

はそれがために「必要」のキーワードがそれをバッククォートされています。

0

私は、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); 
関連する問題