Jump to content

How to reset the id in a table


fritserasmus

Recommended Posts

I have a SQL database that I populate from IoT readings.

It took me a lot of trail and many errors before I got to the point all readings are stored correctly for reporting.

With about 12 sensors each storing a reading every 30 seconds, I have a huge number of records to delete.

After successfully delete them I want to start fresh with record id #

 

id is around 2,000,000.

How do I reset id counter?

 

Regards

Frits

Link to comment
Share on other sites

  • 1 month later...

Hello

Please try this query,To How to reset the id in a table

The DBCC CHECKIDENT management command is used to reset identity counter. The command syntax is:

DBCC CHECKIDENT (table_name [, { NORESEED | { RESEED [, new_reseed_value ]}}])
[ WITH NO_INFOMSGS ]

i hope this query will be useful for you.

Thank you.

Edited by Makwana Prahlad
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...