Jump to content
Sign in to follow this  
fritserasmus

How to reset the id in a table

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...