this might be a dumb question, but i want to reset my auto-incremented id column in one of my tables after I delete all the rows, how do i do that in a mvc 4 web app?
Asked
Active
Viewed 1,471 times
0
-
http://stackoverflow.com/questions/8923114/how-to-reset-auto-increment-in-mysql – Ehsan Sajjad May 22 '14 at 13:13
-
SQL Server, or what database? – Brian Mains May 22 '14 at 13:13
2 Answers
0
i want to reset my auto-incremented id column in one of my tables after I delete all the rows
Use TRUNCATE TABLE tablename
instead of deleting rows - that is much faster and resets the seed for you.
You could also execute the SQL command to reseed an auto-increment field:
DBCC CHECKIDENT ("tablename", RESEED, 0);

D Stanley
- 149,601
- 11
- 178
- 240
0
If SQL Server, you can run the command:
dbcc checkident(TableName, 'RESEED', 0)

Brian Mains
- 50,520
- 35
- 148
- 257