Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to reset count for identity field?
Message
General information
Forum:
ASP.NET
Category:
Databases
Miscellaneous
Thread ID:
00819923
Message ID:
00820347
Views:
20
>I'm having trouble figuring out how to reset an identity field's sequential count in a table, after I manually delete one or more records.
>
>As it is, when I delete the last record in a table, the next record I add adopts the next higher number, as though I hadn't deleted it at all.
>
>I tried changing the seed, but that didn't help, so I set it back to 1.
>
>TIA,
>Jeff

You have to delete all of the entries from the ID field after you change it to some other kind of field. Then reset the field type to an identity type. This will not only renumber your ID's but it will render any relationship unreliable as such you should, of course, only do this during development.

HTH,
~Joe Johnston USA

"If ye love wealth better than liberty, the tranquility of servitude better than the animated contest of freedom, go home from us in peace. We ask not your counsel or arms. Crouch down and lick the hands which feed you. May your chains set lightly upon you, and may posterity forget that ye were our countrymen."
~Samuel Adams

Previous
Next
Reply
Map
View

Click here to load this message in the networking platform