1

Sounds simple but I seem to have a tough time in dropping a primary key on a table in mysql - Have a table CompanyList with CompID as the primary key. It is being used as a foreign key in a bunch couple of other tables in the database.

I want to retain the field CompID but I do not want it to be the primary key.

I tried removing the primary key from CompID but got the error.

ERROR: Error when running failback script. Details follow. ERROR 1050: Table 'CompanyList' already exists

Should I drop all the foreign key references in order to achieve this.

Any help would be greatly appreciated.

user275157
  • 1,332
  • 4
  • 23
  • 45

1 Answers1

0

Yes, you have to drop all FOREIGN KEYs to drop the PRIMARY KEY they reference.

Branko Dimitrijevic
  • 50,809
  • 10
  • 93
  • 167