Error 1064

Error 1064

am 08.06.2010 20:45:53 von Brad Scott

--_4d08fa4d-7118-465d-8ccc-9c828fdf5307_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable



I am receiving this error:

ERROR 1064: You have an error in your SQL syntax. Check the manual that co=
rresponds to you MySQL server version for the right syntax to use near '16 =
varchar(255) NOT NULL default 'Not applicable'=2C 17a varch

I have version 4.0.16 and have a dump file that I'm trying to recreate into=
a new database.

The following is the table that is trying to be created along with some of =
the fields:


CREATE TABLE assessment_child_psych (
id int(11) NOT NULL auto_increment=2C
form_version smallint(6) NOT NULL default '1'=2C
client_id int(11) NOT NULL default '0'=2C
assessment_date datetime NOT NULL default '0000-00-00 00:00:00'=2C
user_id int(11) NOT NULL default '0'=2C
status varchar(20) NOT NULL default 'Pending'=2C
6a varchar(255) NOT NULL default 'Not applicable'=2C
6b varchar(255) NOT NULL default 'Not applicable'=2C
6c varchar(255) NOT NULL default ''=2C
7a varchar(255) NOT NULL default 'Not applicable'=2C
7b varchar(255) NOT NULL default ''=2C
7c varchar(255) NOT NULL default ''=2C
8a varchar(255) NOT NULL default 'Not applicable'=2C
9a varchar(255) NOT NULL default 'Not applicable'=2C
9 varchar(255) NOT NULL default 'Not applicable'=2C
9b varchar(255) NOT NULL default 'Not applicable'=2C
10a varchar(255) NOT NULL default 'Not applicable'=2C
10 varchar(255) NOT NULL default 'Not applicable'=2C
10b varchar(255) NOT NULL default ''=2C
10_describe varchar(255) NOT NULL default ''=2C
11a varchar(255) NOT NULL default 'Not applicable'=2C
11b varchar(255) NOT NULL default ''=2C
12a varchar(255) NOT NULL default 'Not applicable'=2C
12b varchar(255) NOT NULL default ''=2C
13a varchar(255) NOT NULL default 'Not applicable'=2C
13b varchar(255) NOT NULL default ''=2C
13b_other varchar(255) NOT NULL default ''=2C
14a varchar(255) NOT NULL default 'Not applicable'=2C
14b varchar(255) NOT NULL default ''=2C
14c varchar(100) NOT NULL default 'Not applicable'=2C
14cexplain varchar(255) NOT NULL default ''=2C
15a varchar(255) NOT NULL default 'Not applicable'=2C
15b varchar(255) NOT NULL default ''=2C
16 varchar(255) NOT NULL default 'Not applicable'=2C
17a varchar(255) NOT NULL default 'Not applicable'=2C
17b varchar(255) NOT NULL default ''=2C

Any line beginning with just a number (ie 9=2C 10=2C 16) causes a failure. =
What am I missing?


=20
____________________________________________________________ _____
Hotmail has tools for the New Busy. Search=2C chat and e-mail from your inb=
ox.
http://www.windowslive.com/campaign/thenewbusy?ocid=3DPID283 26::T:WLMTAGL:O=
N:WL:en-US:WM_HMP:042010_1=

--_4d08fa4d-7118-465d-8ccc-9c828fdf5307_--

Re: Error 1064

am 08.06.2010 21:01:44 von Mattia Merzi

Hi Brad,

2010/6/8 Brad Scott :
[...]
> Any line beginning with just a number (ie 9, 10, 16) causes a failure. What am I missing?

you should add backticks ( ` ) at both ends of the column name, e.g.
`7c` varchar(255) NOT NULL default '',

I think your export should have been done with the option --quote-names enabled.

Hope this helps, unfortunately I have no mysql instances available to
test at the moment...

Greetings,

Mattia.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: Error 1064

am 08.06.2010 21:02:40 von Carsten Pedersen

Brad Scott skrev:

>
> Any line beginning with just a number (ie 9, 10, 16) causes a failure. What am I missing?

backticks. Use `9`, `10`, etc.

Having column names that begin with numbers is a really bad design
decision. "9a123" (unquoted, of course) will work, as you've noticed,
but e.g. "0x123" is going to give you a nasty surprise.

/ Carsten

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org