Use DBCC CHECKIDENT to RESEED Table Identity Columns

In many tables we use Identity column to maintain the uniqueness and automatically increment the values when records are inserted. If you want to reset the identity column numbers in a table then we can use DBCC CHECKIDENT T-SQL command with RESEED.

Syntax:

DBCC CHECKIDENT (TableName, RESEED, ReseedValue)

Example:

DBCC CHECKIDENT (tblEmployee, RESEED, 100)

Suppose if you have 100 records with last identity number as 100 and you want to start next record identity number as 101 then you can use above query.

In other example, if you have 100 records with last identity number as 100 and you want to start next record from identity 150 then you can use below query.

DBCC CHECKIDENT (tblEmployee, RESEED, 149)

To practice how to create SQL Identity column you can  refer following article.

SQL IDENTITY Column – Auto Increment Column Values

Reference: Manzoor Siddiqui [www.SQLSeverLog.com]

You may also like

You may also like...

Leave a Reply