Re: adding record w ID=0 On 2007-06-20 14:48:07 +0200, strawberry <zac.carey@gmail.com> said:
> On Jun 20, 6:03 am, Josselin <josse...@wanadoo.fr> wrote:
>> I have an already existing table created w auto-increment (starting : 1)
>> I need to add a record w ID=0 manually...
>> I tried to do it w phpmyadmin... but I always get a new record w the
>> last increment value +1 never the 0...
>> how can I do it manually ?
>>
>> thanks for your help ..
>>
>> joss
>
> You can't.
>
> You can alter the table...
>
> ALTER TABLE `my_table` CHANGE `id` `id` TINYINT( 4 ) NOT NULL
>
> ...and then insert your 0 value...
>
> INSERT INTO `my_table` (id) VALUES (0)
>
> ...but when you revert the structure...
>
> ALTER TABLE `id` CHANGE `id` `id` TINYINT( 4 ) NOT NULL
> AUTO_INCREMENT
>
> ...the table will renumber itself from 1!
OK thanks.. maybe creating a new table with increment starting at 0
then importaing all data and renaming the table ... |