I created a primary key to be autoincrement.
- I added two rows:
ID=1, ID=2 - I deleted these two rows.
- I added a new row, but the new row’s ID was:
ID=3
How can I reset or restart the autoincrement to 1?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you use the
DBCC CHECKIDENTcommand:But use with CAUTION! – this will just reset the
IDENTITYto 1 – so your next inserts will get values 1, then 2, and then 3 –> and you’ll have a clash with your pre-existing value of 3 here!IDENTITYjust dishes out numbers in consecutive order – it does NOT in any way make sure there are no conflicts! If you already have values – do not reseed back to a lower value!