List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:December 22 2000 2:24pm
Subject:Re: Setting derault for auto_increment
View as plain text  
At 9:00 AM +0100 12/22/00, Carsten H. Pedersen wrote:
>From: "Paul DuBois" <paul@stripped>
>Sent: Friday, December 22, 2000 3:39 AM
>
>>  At 2:58 PM -0800 12/21/00, Jason Bell wrote:
>>  >add DEFAULT 'value' into your column string..... should work.....
>>
>>  Actually, you specify it when you create the table:
>>
>>  CREATE TABLE tbl_name ( column definitions ) AUTO_INCREMENT = initial_number
>>
>>  See:
>>
>>  http://www.mysql.com/documentation/mysql/commented/?section=CREATE_TABLE
>
>Note, however, that this value is reset to 0 if all the table
>entries are deleted.


True, unless you delete like this:

DELETE FROM tbl_name WHERE 1 > 0

to force a row-by-row deletion.

>
>/ Carsten
>--------
>Carsten H. Pedersen
>Keeper and maintainer of the bitbybit.dk MySQL FAQ
>http://www.bitbybit.dk/mysqlfaq
>
>>
>>  >Jason
>>  >
>>  >----- Original Message -----
>>  >From: "Scott Gerhardt" <scott@stripped>
>>  >To: "Mysql" <mysql@stripped>
>>  >Sent: Thursday, December 21, 2000 2:52 PM
>>  >Subject: Setting derault for auto_increment
>>  >
>>  >
>>  >>  I'm adding an AUTO_INCREMENT column to a table and would like to set
> the
>>  >>  starting number.
>>  >>  What is the easy way to do this?
>>  >>  Can't seem to find the answer in the online docs.
>>  >>  I can't seem to set the default using auto_increment=999 etc.
>>  >>
>>  >>  I guess a work-around would be to insert a dummy row into the table
> with
>>  >the
>>  >>  value I want, set the column to auto_increment and then remove the
> dummy
>>  >>  row, but this seems like extra work.
>>  >>
>>  >>  - Scott
>>  >>
>>  >>
>>  >>  ___________________________________
>>  >>
>>  >>  Scott A. Gerhardt  P.Geo.
>>  >>  Gerhardt Information Technologies
>>  >>  scott@stripped
>  >>  ___________________________________


-- 
Paul DuBois, paul@stripped
Thread
Setting derault for auto_incrementScott Gerhardt21 Dec
  • Re: Setting derault for auto_incrementJason Bell21 Dec
    • Re: Setting derault for auto_incrementPaul DuBois22 Dec
  • Re: Setting derault for auto_incrementCarsten H. Pedersen22 Dec
    • Re: Setting derault for auto_incrementPaul DuBois22 Dec