![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
In my main table I have: CREATE TABLE maintable { id INT UNSIGNED NOT NULL AUTO_INCREMENT, .... linkid INT UNSIGNED, ... ... lastfield VARCHAR(10), PRIMARY KEY(id), INDEX (linkid ), FOREIGN KEY (linkid ) REFERENCES subtable(linkid ) ) ENGINE=INNODB; CREATE TABLE subtable ( linkid INT UNSIGNED NOT NULL AUTO_INCREMENT, linkvalue VARCHAR(20), PRIMARY KEY (linkid) ) ENGINE=INNODB; I keep getting an error: "Foreign key constraint is incorrectly formed" Appreciate any help on what I'm doing wrong.. Thanks... Bruce |
#3
| |||
| |||
|
|
On 12/19/2010 12:29 PM, bruce wrote: In my main table I have: CREATE TABLE maintable { id INT UNSIGNED NOT NULL AUTO_INCREMENT, .... linkid INT UNSIGNED, ... ... lastfield VARCHAR(10), PRIMARY KEY(id), INDEX (linkid ), FOREIGN KEY (linkid ) REFERENCES subtable(linkid ) ) ENGINE=INNODB; CREATE TABLE subtable ( linkid INT UNSIGNED NOT NULL AUTO_INCREMENT, linkvalue VARCHAR(20), PRIMARY KEY (linkid) ) ENGINE=INNODB; I keep getting an error: "Foreign key constraint is incorrectly formed" Appreciate any help on what I'm doing wrong.. Thanks... Bruce Does subtable actually exist when you create maintable? I'm assuming this isn't the actual SQL you're using. *Try posting the exact statements (i.e. cut/paste) you're using. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstuck... (AT) attglobal (DOT) net ================== |
![]() |
| Thread Tools | |
| Display Modes | |
| |