2011-08-16 3 views
1

이 오류가 발생하는 이유는 무엇입니까? 어떤 구문이 보이지 않을 수도 있으므로 도움을 주시면 감사하겠습니다.INSERT INTO 구문 오류 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); 

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의 워크 벤치에 쿼리 붙여-복사하고, 당신이 테이블 컬럼의 이름으로 예약 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);