Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2003

    Unanswered: ALTER TABLE with foreign keys not working

    I have MySQL installed and running, and now am trying to add a foreign key to a table. Every foreign key I have added to all the other tables works, but in this table it simply refuses. I have a table Clients and a table Fees. Clients has a PKEY of ClientID and Fees has a column ClientID that has been indexed. All types are the exact same. When I run the alter table command, I get the error that SHOW INNODB STATUS gives:

    No Index Defined on ClientID

    040418 18:51:23 Error in foreign key constraint of table wildcatvideoservice/#sql-4f48_653:
    Cannot find an index in the referenced table where the
    referenced columns appear as the first columns, or column types
    in the table and the referenced table do not match for constraint:
    See for correct foreign key definition.

    Please Help!

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    perhaps you could dump out the CREATE TABLE statements so that we could give it a try? | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts