Re: MySQL auto_increment ??

From: Date: Thu, 07 Mar 2002 05:38:34 +0000
Subject: Re: MySQL auto_increment ??
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-12498@lists.php.net to get a copy of this message
"Sviss Cobazor" <sviss@nospam.dk> wrote in message news:20020306123919.36310.qmail@pb1.pair.com... > Now I want to delete user with ID = 2. > Now I create a new user, he will get ID = 4. > > How can i reuse the ID 2 for creation of new users? I am not familiar with MySQL specifically but in my database experience you cannot reuse an auto-increment number. One approach I have taken in the past is to have my own table with a number field(s) and manually increment it, then use that in the other tables. I suppose you could scan for unused numbers but this seems quite time consuming. You just have to be aware of locking other write requests so no two try to share a number. > Another thing: > If ID is INT(3), what will happen when I insert user no. 1000? Most databases I've seen make an autoincrement field a longint. - Steve Yates - Gone crazy, be back later. Please leave a message. <Beep!> / Taglines by Taglinator - www.srtware.com /

« previous php.windows (#12498) next »