Ways of Reseting an Identity Column in the table.

Vishalneeraj-24503
Posted by Vishalneeraj-24503 under Sql Server category on | Points: 40 | Views : 401
Using Delete and then CHECKIDENT 
DELETE FROM DUMMY
DBCC CHECKIDENT(DUMMY,RESEED, 0)
SELECT * FROM DUMMY;

INSERT INTO DUMMY(NAME) VALUES('1');
INSERT INTO DUMMY(NAME) VALUES('2');
SELECT * FROM DUMMY;

Using Truncate
Truncate Table DUMMY;
INSERT INTO DUMMY(NAME) VALUES('1');
INSERT INTO DUMMY(NAME) VALUES('2');
SELECT * FROM DUMMY;

Comments or Responses

Login to post response