sql reseed
December 21, 2007 at 5:04 pm | In SQL | 3 CommentsI used to get irritated with my identity column when it increases to somewhere in 300s in my sample applications. I used to drop my table and create it again.Today i saw an article for resetting the identity column.
use databasename
go
dbcc checkident(tablename, reseed,seed value)
This will search the table for the highest ID field, and reset the seed to the seed value specified.
While we are at it, here are some other useful DBCC commands:
To check the integrity of a table:
dbcc checktable(tablename)
To force a table to rebuild its indexes:
dbcc dbreindex(tablename)
Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.