+ 2

Auto increment will restart from 1??

suppose a table contains an auto increment column(ABC) and has 20 rows of values. now I delete all data from the table. What will be the value of ABC when we insert a new row? will it again start from 1?

4th Jul 2018, 4:40 PM
Arindam Mondal
Arindam Mondal - avatar
5 Respuestas
0
Toni Isotalo thanks. can you please see my anther question? I specified it with more details there https://www.sololearn.com/discuss/1386800/?ref=app
4th Jul 2018, 5:58 PM
Arindam Mondal
Arindam Mondal - avatar
+ 5
No it continues from the last id. You can recreate the table or use AUTO_INCREMENT = 1 to restart it.
4th Jul 2018, 4:45 PM
Toni Isotalo
Toni Isotalo - avatar
+ 1
you can use AUTO_INCREMENT=1. that must work normally
5th Jul 2018, 6:42 AM
Serigne Fallou DIAGNE
Serigne Fallou DIAGNE - avatar
+ 1
otherwise you can try: USE «databasename»; GO DBCC CHECKIDENT ('«tablename»'); GO
17th Jul 2018, 3:37 PM
Pablo David Quintana Erazo
Pablo David Quintana Erazo - avatar
0
Serigne Fallou DIAGNE thanks. can u please follow the upper link and visit
5th Jul 2018, 7:26 AM
Arindam Mondal
Arindam Mondal - avatar