Friday, September 25, 2015

Reset Identity Column in SqlServer

Using Truncate Method.
 Using DBCC (database consistency checker)
--- TRUNCATE TABLE cannot be used when a foreign key references the table to be truncated where as DBCC can.

here is the Query using DBCC


DBCC CHECKIDENT('Table Name', RESEED, 0)
In Above query '0' is the reset idetity seed number,you can give any number whatever you want like 100,200 etc.
---Here is the Query Using Truncate 
truncate table TableName