|
Home > Archive > MySQL ODBC Connector > December 2005 > error 1064 when trying to create table
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
error 1064 when trying to create table
|
|
| Nabegh Al-Thalji 2005-12-25, 8:23 pm |
| When I execute the following query
CREATE TABLE Sponsor (
sNum INTEGER UNSIGNED NOT NULL,
sAdrBlock CHAR(2),
sCivil_ID CHAR(12),
sDateOfBirth DATE,
sDrvLicenseExp DATE,
sDrvLicenseNum CHAR(9),
sGender ENUM('M','F'),
sName VARCHAR(20),
sStatus VARCHAR(20),
sTelephone CHAR(7),
A_areaNum INTEGER UNSIGNED NOT NULL,
G_goverNum INTEGER UNSIGNED NOT NULL,
O_occupNum INTEGER UNSIGNED NOT NULL,
N_nationNum INTEGER UNSIGNED NOT NULL,
PRIMARY KEY (sNum),
FOREIGN KEY (A_areaNum) REFERENCES Area(areaNum),
FOREIGN KEY (G_goverNum) REFERENCES Governate(goverNum),
FOREIGN KEY (O_occupNum) REFERENCES Occupation(occupNum)
,
FOREIGN KEY (N_nationNum) REFERENCES Nationality(nationNu
m)
);
I get the following error
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
'Area(areaNum),
FOREIGN KEY (G_goverNum) REFERENCES Governate(goverNum),
at line 17
Any ideas?
Thanks
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? unsub...sie.nctu.edu.tw
| |
| Detlev Jaeger 2005-12-26, 3:28 am |
| Hi,
You are using a reserved function name "AREA" (polygon function) as a
fieldname. Simply change the field's name or try using quotes around
it...
Detlev
> [...]
> FOREIGN KEY (A_areaNum) REFERENCES Area(areaNum),
> [...]=20
> Any ideas?
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? unsub...sie.nctu.edu.tw
| |
| Gleb Paharenko 2005-12-26, 11:23 am |
| Hello.
> FOREIGN KEY (A_areaNum) REFERENCES Area(areaNum),
Put Area in backticks ('`'). See:
http://dev.mysql.com/doc/refman/5.0/en/legal-names.html
Nabegh Al-Thalji wrote:
> When I execute the following query
>
> CREATE TABLE Sponsor (
> sNum INTEGER UNSIGNED NOT NULL,
> sAdrBlock CHAR(2),
> sCivil_ID CHAR(12),
> sDateOfBirth DATE,
> sDrvLicenseExp DATE,
> sDrvLicenseNum CHAR(9),
> sGender ENUM('M','F'),
> sName VARCHAR(20),
> sStatus VARCHAR(20),
> sTelephone CHAR(7),
> A_areaNum INTEGER UNSIGNED NOT NULL,
> G_goverNum INTEGER UNSIGNED NOT NULL,
> O_occupNum INTEGER UNSIGNED NOT NULL,
> N_nationNum INTEGER UNSIGNED NOT NULL,
> PRIMARY KEY (sNum),
> FOREIGN KEY (A_areaNum) REFERENCES Area(areaNum),
> FOREIGN KEY (G_goverNum) REFERENCES Governate(goverNum),
> FOREIGN KEY (O_occupNum) REFERENCES Occupation(occupNum)
,
> FOREIGN KEY (N_nationNum) REFERENCES Nationality(nationNu
m)
> );
>
> I get the following error
>
> 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
> 'Area(areaNum),
> FOREIGN KEY (G_goverNum) REFERENCES Governate(goverNum),
> at line 17
>
> Any ideas?
> Thanks
>
--
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Gleb Paharenko
/ /|_/ / // /\ \/ /_/ / /__ Gleb.Paharenko@ensita.net
/_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.NET
<___/ www.mysql.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? unsub...sie.nctu.edu.tw
|
|
|
|
|