At 3:15 PM -0400 9/17/01, Jay Fesco wrote:
>  >  Can someone tell me how to reset a column's auto_increment starting point
>>   back to 0 in mysql ?
>>
>>   Thanks
>>
>>   Paul
>>
>According to Paul DuBois on page 169 of MySQL by New Riders (which you
>should buy):
>
>ALTER TABLE t
>     DROP i,
>     ADD i INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY
>
>Jay

Actually, this will drop the column and renumber the rows sequentially.

To just reset the sequence to 0 (well, to 1, since sequences start at 1),
do this:

ALTER TABLE t AUTO_INCREMENT = 1



-- 
Paul DuBois, [EMAIL PROTECTED]

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to