Tips and scripts relating to database administration. Mainly SQL Server but some MySQL and every now and again something different. Posts are brief and to the point.It's as much a place to make notes for my own use as anything else.
Tuesday, 8 September 2009
Reset Identity Column in SQL Server
To check the current value of an identity field use:
DBCC CHECKIDENT (tablename, NORESEED)
To set the next identity value to 100 for a table use:
DBCC CHECKIDENT (tablename, RESEED, 99)
Note that the next value will be whatever you reseed + 1.
No comments:
Post a Comment