List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:February 5 2000 3:41am
Subject:Re: Auto-Increment question
View as plain text  
At 9:26 PM -0600 2000-02-04, Josh Abrams wrote:
>Sorry, let me clarify somewhat.
>
>What I meant to say was that the _default_ value seems to be 0, even
>though I specify an initial default of 1000 when creating or modifying the
>field.
>
>Is it possible to set the default value to anything other than 0?


Yes, it is, but you must be running MySQL 3.23.  To set the initial
AUTO_INCREMENT value, add a clause to the end of your CREATE TABLE
statement:

CREATE TABLE tbl_name( column declarations ) AUTO_INCREMENT = 1000

If you have already created the table, you can use ALTER TABLE
to specify the value:

ALTER TABLE tbl_name AUTO_INCREMENT = 1000

The default value that shows up when you use DESCRIBE or SHOW COLUMNS
is unrelated to the actual value that next will be generated.


>
>On Fri, 4 Feb 2000, Paul DuBois wrote:
>
>>  At 7:58 PM -0600 2000-02-04, Josh Abrams wrote:
>>  >I'm running tests on a field using the auto-increment feature. Does the
>>  >auto-increment always start at 0? I attempted to specify another number,
>>  >but it still defaulted to 0.
>>
>>  ???
>>
>>  AUTO_INCREMENT values *never* start at zero.  When you insert NULL
>>  or 0 into an AUTO_INCREMENT column, the next number in the series
>  > is generated.  The series begins at one.


-- 
Paul DuBois, paul@stripped
Thread
Suggest to us PHP/mySQL web hostSlim Baltagi5 Feb
  • Using MySQL to do messagingJosh Abrams5 Feb
    • Auto-Increment questionJosh Abrams5 Feb
      • Re: Auto-Increment questionPaul DuBois5 Feb
        • Re: Auto-Increment questionJosh Abrams5 Feb
          • Re: Auto-Increment questionPaul DuBois5 Feb
          • F a t a l E r r o rd e l   d h a n o a5 Feb
          • Vs: F a t a l E r r o rVille Mattila5 Feb
    • Re: Using MySQL to do messagingsasha5 Feb
RE: Suggest to us PHP/mySQL web hostTobe Johnson5 Feb
  • RE: Suggest to us PHP/mySQL web hostBill Gerrard5 Feb
RE: Suggest to us PHP/mySQL web hostTobe Johnson5 Feb