List:MySQL on Win32« Previous MessageNext Message »
From:Randy Clamons Date:February 5 2004 10:48pm
Subject:Re: ALTER TABLE MODIFY, AUTO_INCREMENT attribute lost
View as plain text  
Theo,

Your best bet is to drop the ItemId column, then add it back in with the
proper syntax.

ALTER TABLE items
         DROP COLUMN itemid;

ALTER TABLE items
         ADD COLUMN ItemId INT(11) NOT NULL AUTO_INCREMENT FIRST;

Good luck!


At 10:33 PM 02/05/2004 +0000, Theodosios Paschalidis wrote:
>HI all,
>
>I am a newbie so please excuse my ignorance. I used
>ALTER TABLE items MODIFY ItemID INT(11) FIRST;
>to put the ItemID column first, but since I didn't specify, it lost it's 
>NOT NULL and AUTO_INCREMENT attributes.
>
>ALTER TABLE items MODIFY ItemID INT(11) NOT NULL AUTO_INCREMENT FIRST;
>
>or any attempt to change the column to AUTO_INCREMENT is gives me
>ERROR 1062 (23000): Duplicate entry '1' for key 1
>
>I've tried using ALTER TABLE items AUTO_INCREMENT=requiredValue; with no 
>success
>
>Can anybody please help since I am stuck and I am sure it is something 
>very simple. I don't want to drop and attempt a restore for something 
>trivial like this.
>
>Thank you for you time,
>Theo
>

Randy Clamons
Astro-Auction.com.
Systems Programming

Thread
ALTER TABLE MODIFY, AUTO_INCREMENT attribute lostTheodosios Paschalidis5 Feb
  • Re: ALTER TABLE MODIFY, AUTO_INCREMENT attribute lostRandy Clamons5 Feb
    • Re: ALTER TABLE MODIFY, AUTO_INCREMENT attribute lostTheodosios Paschalidis6 Feb