-- Dilly raja <[EMAIL PROTECTED]>

I created a table in mysql in which i  set a field "id" in that table to
auto_increment and this field is the primary key to this tabel. so each
time  a new record is added the id increment by 1. When i delete a last
record and insert the next record it increment the value from the deleted
record only instead of the last existing record. Is there any solution in
which i can set these values or reset the auto_increment so that it starts
from the first when i delete all the record.

This is not a DBI issue at all, but one for MySQL.
You'll probably get better answers in the future
on a MySQL mailing list than this one for database
issues.

Auto-increment fields are really indended for use
as surrogate keys. As such, they are not intended
for use on tables that will have records deleted
from them. You might do better to create a single
table, call it "sequence" with a single unsigned
integer and select its value for update, increment,
then store it using DBI when you add records. If
you are adding multiple records and have the count
in advance then increment the sequence by that
number instead of one to get a bulk list.


--
Steven Lembark                                       85-09 90th Street
Workhorse Computing                                Woodhaven, NY 11421
[EMAIL PROTECTED]                                     1 888 359 3508

Reply via email to