Resetting Table Identity value using DBCC CHECKIDENT in TSQL

DBCC CHECKIDENT Checks the current identity value for the specified table and, if it is needed, changes the identity value. You can also use DBCC CHECKIDENT to manually set a new current identity value for the identity column.

For example, YourTable has 45 rows with 45 as last identity.
If we want next record to have identity as 55 we need to run following T SQL script.

DBCC CHECKIDENT (yourtable, reseed, 54)


Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s