Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reset identity column in MS Access

I have a windows application connected with MS Access 2007 database

It had more than 300 records in Customer Table.

I have deleted all records. but after inserting a new record CustomerID returns 301; but I want to set it to 1.

I tried the following query:

ALter Table Customer alter column CustomerID Counter(1,1)

but it doesn't work

How can I reset an identity column in MSAccess??

Thanks

like image 245
ghanshyam.mirani Avatar asked Jan 16 '23 04:01

ghanshyam.mirani


1 Answers

On the operational side, you can drop an readd the column.

On the strategic side, I think you should rethink the problem: If the value of an identity column, apart from being unique, matters to you, you might be heading in a dangerous direction: You should think of such a column as being completly without content, apart from being a way to uniquely address a row.

like image 100
Eugen Rieck Avatar answered Jan 22 '23 06:01

Eugen Rieck