2

I am at a loss why I am getting this error. It might something I can't see in my syntax so any help would be greatly appreciated.

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 - You have an error in your SQL syntax; check the manual

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

Thanks.

3
  • 1
    That DATE '2009-12-10' looks a little iffy. Have you tried it with just '2009-12-10'? Commented Aug 16, 2011 at 20:23
  • I've been using DATE for all the inserts and it's been working fine. Commented Aug 16, 2011 at 20:24
  • My apologies, I was thinking of sql server syntax, even you clearly mentioned mysql =/ Commented Aug 17, 2011 at 4:58

3 Answers 3

9

REQUIREis a reserved MySQL keyword. You must enclose it in backquotes as:

`require`

Also, it's worth pointing out that MySQL escapes single quotes with a backslash, not two single-quotes like SQL Server and Access. This phrase may become problematic if the above is your exact SQL statement and that single quote has not been escaped:

Applican''t condition
Sign up to request clarification or add additional context in comments.

3 Comments

+1. Why is it that people are always faster than me? ;) BTW, it normally doesn't hurt to always backquote identifier names in MySQL
I just exported the data in the VALUES section from access so I guess that's how they did it.
@Datacommie you will probably need to do a search/replace for '' to \'
2

it's because "require" is a keyword backtick it.

Comments

0

I copy-pasted your query to MySQL Workbench, and it seems that you are using reserved require keyword as a name of a table column, to fix that:

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.