Reset Identity Column seed value in SQL

Step 1: Create table:
 
CREATE TABLE tablename
( ID INT IDENTITY(1001,1) NOT NULL,
dateofInsertion DATETIME NOT NULL )
 
Step 2: Insert the record in the Table using this statement.
 
INSERT INTO tablename(dateofInsertion) VALUES(GETDATE()),(GETDATE()),(GETDATE()),(GETDATE()),(GETDATE())
 
Result is like this:
 
Step 3: Now, if you want to reset the identity seed value of the existing table,
then write an SQL statement such as given below.
 
DBCC CHECKIDENT (tablename, reseed, 200000) 
 
Step 4:  Again insert a new record in this table using this SQL statement.
 INSERT INTO tablename(dateofInsertion) VALUES(GETDATE()),(GETDATE()),(GETDATE()),(GETDATE()),(GETDATE())
 
Step 4: After Resetting the identity value of the existing table, the result looks like this:
 
 
Thanks.......... 
Ebook Download
View all
Learn
View all