List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:December 27 2002 10:59pm
Subject:Re: start value in table
View as plain text  
At 22:34 +0100 12/27/02, Martin Skjöldebrand wrote:
>Sorry for this newbie question (my MySQL-book is at work).
>I want my ID field to start with value 1000 and (preferably)
>auto-increment to 2000 is this possible to specify in my table somehow?

This question is ambiguous.  Do you mean that you want a starting value
of 1000, and for subsequent records to auto_increment by 1000 each time?
If so, you cannot ask MySQL to do that automatically.

Or do you mean that you want the normal increment-by-one behavior, but
you just want the first value to be 1000?  If so, use a MyISAM table,
and declare it as follows:

CREATE TABLE tbl_name (column definitions here)
TYPE = MyISAM AUTO_INCREMENT = 1000;

The final AUTO_INCREMENT = n clause causes the first record to be assigned
that value in the AUTO_INCREMENT column.

>(I know auto-increment, just how do I set the starting value).
>What would the appropriate SQL-sentence to update the table be?
>
>Cheers,
>
>Martin S.
>--
>Martin Skjoldebrand
>http://www.skjoldebrand.org
>

Thread
start value in tableMartin Skj√∂ldebrand27 Dec
  • RE: start value in tableFernando Grijalba27 Dec
    • RE: start value in tableKeith C. Ivey27 Dec
  • Re: start value in tableMartin Skj√∂ldebrand27 Dec
  • Re: start value in tablePaul DuBois27 Dec