MySQL Forums
Forum List  »  Newbie

Automatic counter for ID (AUTO_INCREMENT?)
Posted by: Petra Enis
Date: May 29, 2012 12:44AM

Good Morning,

I am new here and I hope you can help me with my problem.
I would like that the column “ID” counts automatically when I add new data to my SQL-table.
Now I already found out that it’s somehow possible by using the command „AUTO_INCREMENT“.
Unfortunately I get an error when I select “AUTO_INCREMENT“ for “ID“:
SQL-Befehl:
Quote

ALTER TABLE `table00001` CHANGE `ID` `ID` INT( 11 ) NOT NULL AUTO_INCREMENT
MySQL meldet:
#1062 - ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '1' for key 'PRIMARY'

I defined the column “ID” as PRIMARY – maybe that’s the problem?

I look forward to your answers.

Kind regards
Petra

Options: ReplyQuote


Subject
Written By
Posted
Automatic counter for ID (AUTO_INCREMENT?)
May 29, 2012 12:44AM


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.