List:General Discussion« Previous MessageNext Message »
From:Martin Ramsch Date:August 5 1999 11:25am
Subject:Re: Problem with AUTO_INCREMENT
View as plain text  
On Mi, 1999-08-04 11:16:38 -0500, John Littlefield wrote:
> I am having difficulty implementing the 'auto_increment' function
> properly in MySQL.

Well, better call it "as I want", because it works properly as

> I am trying to create an ID field in a table, that is
> auto_incremented by the MySQL engine, but I need to start the
> serialization at a number greater than '1' (specifically
> '100000001').

The best way is to insert a dummy record with rec_id set to 100000000.

You also could issue the command
   SET INSERT_ID=100000000
sometimes before the first insert, but as this would have to be done
in the same connection as as the insert using a dummy record is
probably the easier way.

> ... although this, along with the other abnormalities of MySQL would
> put me in a position of looking for another database solution.

Sure, always choose the tool best fitting your needs, and of course
this isn't MySQL neccessarily--though quite often. :)

Martin Ramsch <m.ramsch@stripped> <URL: >
PGP KeyID=0xE8EF4F75 FiPr=52 44 5E F3 B0 B1 38 26  E4 EC 80 58 7B 31 3A D7
Problem with AUTO_INCREMENTJohn Littlefield4 Aug
  • Re: Problem with AUTO_INCREMENTLuke Meyer4 Aug
  • Re: Problem with AUTO_INCREMENTRalph Graulich4 Aug
  • Re: Problem with AUTO_INCREMENTMartin Ramsch5 Aug
    • Re: Problem with AUTO_INCREMENTMichael Widenius5 Aug