reseed

Tech

Registered User.
Local time
Today, 15:41
Joined
Oct 31, 2002
Messages
267
in MS Access, is there a command like SQL which resets the Identity seed? I need to know this as after i remove all the records, would like the ID reset back to 0
 
There are several autonumber questions and answers in the TABLES page. Try there.
 
thanks i will look for them but im trying to do this from .NET and would like the actual SQL/command for it. I know there are links to other pages but not quite what I had in mind.
 
If you have to reset the sequence on the fly, you are mis-using the autonumber. Autonumbers are intended to provide a unique identifier, nothing else. Search for code to generate your own sequence number and forget the autonumber. Don't forget to include error trapping code that allows you to loop should your code try to insert a number that is already assigned. The heavier your traffic, the more likely you are to generate dups.
 
Thanks. I found out the code/syntax

ALTER TABLE [tableName] ALTER Column [PKColumn] COUNTER(0, 1)

this will reset the seed to 0 incrementing by 1 on every new insert on the given fieldname/PK field

I just wanted to find out how to reset the seed after deleting all records so it starts seeding from 0 going up by 1

:)
 

Users who are viewing this thread

Back
Top Bottom