Monday, November 28, 2011

How To Reset Identity column in SQL Server

The following DBCC Command will reset the Identity value for the given table to 0 so that the next record added starts at 1.

DBCC CHECKIDENT(<TableName>, RESEED, 0)


For Eg., DBCC CHECKIDENT('Employee', RESEED, 0)

We can also use Truncate Table methode to reset identity field on table but it won't be done if the table exists foreign key relation ship.

No comments:

Post a Comment