How to reset autoincrement field value

How to reset autoincrement field value

Post by Jim Fergus » Fri, 11 Apr 1997 04:00:00



Gary,

Quote:>When adding a new record to a recordset that has an autoincrement id the
>value increases even if the the process of adding the record was cancelled.

Correct. This is how Jet autonumber fields work.

Quote:>I would like to put the number back to it's previous value if I cancel the
>update to the new record.

Can't do it. If you need this functionality you'll need to use your
own key-generating mechanism.

Basically the numbers generated in an autonumber field aren't supposed
to "mean" anything. They happen to increment upwards by one, but their
PURPOSE is simply to provide a guaranteed unique value which is
suitable for use as a primary key or unique index. They should not be
used as pseudo-record numbers or as series numbers, such as
CheckNumbers or InvoiceNumbers and so forth.

-- Jim Ferguson, FMS
   http://www.fmsinc.com

 
 
 

How to reset autoincrement field value

Post by Pete Baxte » Fri, 11 Apr 1997 04:00:00


Gary -

Quote:> autoincrement id the back to it's previous value

I have not ever seen a piece of code that does this. I looked a while
back.  However, if you need a sequential count in your records (ie one
that you will renumber when records are deleted), I think you'll have to
create an integer field in the table and do it in code

Anybody heard different ? (Hey MS ... you listening ?)

pCb


[ Pete Baxter                   540.785.2727
[ Distributive Data Systems     540.785.2728 fax
[ ----------------------------------------------

 
 
 

How to reset autoincrement field value

Post by Gary L Clar » Fri, 11 Apr 1997 04:00:00


When adding a new record to a recordset that has an autoincrement id the
value increases even if the the process of adding the record was cancelled.

I would like to put the number back to it's previous value if I cancel the
update to the new record.

How is this done?

 
 
 

1. Resetting Paradox autoincrement value in .VAL file

There is an offset in the Paradox .VAL file, or possibly the .DB file
which allows you to set the next autoincrement value. It does not
involve the usual method restructuring and setting the autoincrement
field to an integer field, setting the highest value to the one you
want, and changing it back to an integer.
It appeared on one of the Delphi newsgroups some time back. Does
anyone know about this?

2. Record xx not in sort order

3. CONVERT & Syntax

4. Resetting autoincrement value on SQL Server

5. How to map server to get data from another drive.

6. How to reset AutoIncrement value?

7. deleting datafiles

8. How do I reset the autoincrement field?

9. HELP: autoincrement field reset

10. Resetting autoincrement fields

11. SQL anywhere 5.5 Autoincrement field resetting

12. Autoincrement fields: how to reset the counter