Bad Syntax

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
DavJans
Posts: 270
Joined: Thu Dec 12, 2013 4:21 pm
Location: Spokane, WA USA

Bad Syntax

Post by DavJans » Thu Mar 19, 2015 9:49 pm

I've been looking at this for an hour now and I cant see it, please help.
INSERT INTO camber (job, pcmk, size, length, rcamber, mcamber, stops, blocks, left, middle, right, date) VALUES ('TEST','TEST','21 X 50','37|SQ 10|DQ','0|DQ 1/2','0|DQ 1/2','B','2','1|DQ 1/2','1|DQ 9/16','1|DQ 1/2', NOW())


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 'left, middle, right, date) VALUES ('TEST','TEST','21 X 50','37|SQ 10|DQ','0|DQ 1' at line 1
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Bad Syntax

Post by Klaus » Thu Mar 19, 2015 11:13 pm

Hi DavJans,

aren't "left, middle, right, date" not some kind of "reserved words" in SQL?


Best

Klaus

DavJans
Posts: 270
Joined: Thu Dec 12, 2013 4:21 pm
Location: Spokane, WA USA

Re: Bad Syntax

Post by DavJans » Thu Mar 19, 2015 11:26 pm

Thank you klaus,

I just came back here to post that i figured it out, it didnt complain about middle, it let me use date, but not left or right.

I figured it out by typing my query into mysql workbench and it highlighted left and right and date, but still let me use date.

however, you can create a table with those in it.... at least now i know.
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

Re: Bad Syntax

Post by SparkOut » Thu Mar 19, 2015 11:37 pm

If you enclose the "reserved" column names in "backticks" ( the left-leaning "single quote" usually found on the top-left side of the keyboard near the tab and the digit 1 depending on your keyboard layout, you might find SQL errors will be sidestepped.

Post Reply

Return to “Databases”