List:General Discussion« Previous MessageNext Message »
From:Vivek Khera Date:April 2 1999 9:24pm
Subject:Re: Autoincrement Field Loses Count
View as plain text  
>>>>> "JSG" == Josh S Gough <dasjsg@stripped> writes:

JSG> However, mine doesn't care about the table being emptied, it will just
JSG> take the largest value and add one to it, so when I then delete the
JSG> largest value, inserting a new record takes that largest value again.
JSG> This isn't what I want and from some posts I've read, it shouldn't do this
JSG> at all actually.

But that's how auto_increment is defined: it returns one higher than
the highest current value for that numeric field.

If that's not what you want, then you'll need to create a separate
table of a single integer with one row in it that you lock, increment,
and unlock.  Then use the value from that table as your "next" value.


								v.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D.                Khera Communications, Inc.
Internet: khera@stripped       Rockville, MD       +1-301-545-6996
PGP & MIME spoken here            http://www.kciLink.com/home/khera/
Thread
Autoincrement Field Loses CountJose de Leon3 Apr
Re: Autoincrement Field Loses CountJosh S. Gough3 Apr
  • Re: Autoincrement Field Loses CountVivek Khera3 Apr
    • Re: Autoincrement Field Loses CountJosh S. Gough3 Apr
      • Re: Autoincrement Field Loses CountPaul DuBois3 Apr