Hugh Sasse <[EMAIL PROTECTED]> wrote on 10/13/2005 11:27:44 AM: > I'm fairly new to MySQL and am getting an error messages like: > > ERROR 1064 (42000) at line 5: 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 '"id" int(14) unsigned NOT NULL auto_increment, > "forename" varchar(40) NOT NU' at line 2 > neelix hgs 18 %> > > So it doesn't tell me exactly where, or what the nature of the > syntax error is (and it can't even tell me it is version 4.1.13 > which I know already). It has truncated the second line, so it's not > that the rest is missing. My editor's syntax highlighter doesn't > show anything awful. This is actually for lines 7 and 8 of the > input, the first 4 lines being comments, so the numbering in the > output is wrong. > > Are there any tools (like lint for C) to be more verbose and helpful > about this? > > Thank you, > Hugh >
MySQL does not normally use " "(double quotes) as name identifiers, it uses ` `(backticks). Change all of your " to ` to make your syntax correct. That would mean that part of your original statement will look like `id` int(14) unsigned NOT NULL auto_increment, `forename` varchar(40) NOT NULL, In this case "line 2" did not refer to the position in the script but to the line within the statement. Your line 1 was something like CREATE TABLE sometablename ( which made your first column definition (the id column) appear on line 2. Make better sense? For more details on ` vs. " please read http://dev.mysql.com/doc/refman/4.1/en/legal-names.html Shawn Green Database Administrator Unimin Corporation - Spruce Pine