ALTER TABLE causes auto_increment resequencing, Resulting in Duplicate entry '1' for key 'PRIMARY'

Asked

Viewed 1,157 times

4

I’m trying to put id as primary key but gives this error:

ALTER TABLE causes auto_increment resequencing, Resulting in Duplicate entry '1' for key 'PRIMARY'

  • 1

    The field is no longer PK !?

  • No, if I was going to give this error Current Selection does not contain a Unique column. Grid Edit, checkbox, Edit, Copy and Delete Features are not available.? why am I trying to edit the most difficult Tables ta

  • 3

    Make sure no value column ID is duplicated!

  • Which command showed error?

1 answer

7

Are there any lines with a value of 0 or NULL in this field? If so, you will need to update them before to a value greater than zero. You can go back to 0 later if you want.

  • No, I was selected A_I took and gave it Duplicate entry '1' for key Primary

  • There is no value that is not positive in this column and all positive values are distinct from each other?

  • Makes a SELECT id, count(*) FROM table_name GROUP BY id and look for the ID you have count() greater than 1.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.