MySQL Forums
Forum List  »  Newbie

cannot modify table to create a new foreign key
Posted by: magilvia
Date: May 13, 2005 10:27AM

I used this syntax:
ALTER TABLE table1 CHANGE field1 field1 char(60) NOT NULL REFERENCES table2(field2)

field1 is INDEX for table1
field2 is PRIMARY KEY for table2

table1 and table are InnoDB type

I'm getting this error:

#1064 - 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 'REFERENCES table2(field2)' at line 1

What's the problem ? I followed MySQL Reference Manual to create the query, it' supposed to work.

Thanks.

Options: ReplyQuote


Subject
Written By
Posted
cannot modify table to create a new foreign key
May 13, 2005 10:27AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.