Monday, March 26, 2012

Reset The Auto Generated Numbers

How can I reset an auto generated number back to start from 1 again.
I made a test table, now to implement the table I need to start the counter back from 1.

The field that I am trying to reset is CustID
It is a primary key for a table and it is set as an Indentity with Increment 1.

Thanks
Taimur"Truncate table" will reset the identity counter to the original seed value.|||or you could use the following (where TestTable is the name of the table):

DBCC CHECKIDENT (jobs, TestTable, 1)|||Sorry... just to correct the previous posting:

DBCC CHECKIDENT (TestTable, RESEED, 1)|||Thanks Iwaker. This worked perfect. :)

Originally posted by lwaker
Sorry... just to correct the previous posting:

DBCC CHECKIDENT (TestTable, RESEED, 1)sql

No comments:

Post a Comment