tags:

views:

32

answers:

2

I have a table, and I just want to remove all unique constraints on it.

I tried dropping the table and remaking it , but it won't work. There is still constraint.

+1  A: 
ALTER TABLE  myTable
  DROP PRIMARY KEY

see the MySQL documentation on ALTER TABLE

The question seems to be only about unique constraints on the table, i.e. a primary key. You can also use a similar syntax of ALTER TABLE to drop foreign key constraints (but you need to name the underlying field, for unlike primary key there may be several per table).

If you are interested in removing the field the primary key is based upon, ALTER TABLE to the rescue again, here with ... RROP COLUMN myColumnName

Finally, as you do all these changes, remember that some foreign key relations and/or the existence of some indexes may require that you drop "things" in an orderly fashion.

mjv
A: 

You need to drop constraints not tables (or maybe both) if I remember correctly

DroidIn.net