We can use DBCC CHECKIDENT to reset the indentity value of SQL table. Let Say, you have a SQL table with Auto-Increment ID. If you delete the records from ID numbers 10-15 and insert the new record, it'll take the next ID i.e. 16.
But if you want the new record starts from ID: 11, you can do this with the help of simple single query:
DBCC CHECKIDENT ('TableName', RESEED, 10)
So, it'll reset the indentity to 10 and next ID will be autoIncrement by 1 i.e. 11.
Happy Programming !!
Thursday, April 14, 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Highly Appreciated your comments