0

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?

user3240928
  • 525
  • 2
  • 4
  • 16

2 Answers2

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