SQL NET - A Place to talk on MS SQL Server and other database tools

Talks on SQL Server, database development, data management techniques,SQLBI/SSIS/SSAS/SSRS etc. Want to publish something db related ? mail to bineeshthomas@gmail.com with subject line starting as "SQLNET"

SQL NET FORUM

Portal Maintained By : BINEESH THOMAS

Monday, October 30, 2006

Resetting seed of an identity column

Deleting last row and inserting record after will make a missing number for identity columns. This case we have to reset the id column. Use the following code to reset identity column.

 

Declare @mxCnt as int

Select @mxCnt= max( ID_Column ) from table_name

DBCC CHECKIDENT (table_name, RESEED,@mxCnt)

0 Comments:

Post a Comment

<< Home

Free Domain Name - www.YOU.co.nr!