Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can i reset an autonumber?

Status
Not open for further replies.

joebickley

Programmer
Aug 28, 2001
139
0
0
GB
Hi
I have always wondered if there is a way that i can reset a AutoNumber field back to 1. I have been doing some testing work with a database and i want all the counters reset

Thanks

Joe Bickley
 
The best way I can think of is to delete the field and add it back. You will have to reestablish any relationships and sync up any related tables.
Dave Robinder, MCSD
Programmer
Colorado DataScapes
Colorado Springs, CO
(719) 328-1111
 
Yeah i have done something similar before, i just changed the datatype saved the table and then changed it back to an autonumber. But again you have to reattach all of the relationships. I just thought there may have been an easier way

Thanks All the same

Joe Bickley
MCDBA (wannabie)
 
The autonumber should reset if you delete all the records in a table and then compact & repair. If some records remain in a table, the autonumber should reset to the highest existing autonumber in that table, plus one.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top