We can also reseed the identity field value. By doing so identity field values will start with a new defined value. This method checks the current identity value for the specified table in SQL Server and, if it is needed, changes the identity value. We use DBCC CHECKIDENT method to manually set a new identity value for the identity column.
Hi, the below query will work for new Entries, if you want to change existing one , u have to make manually by drop Primary key & again call auto increment
Pankaj Kumar ChoudharyRank #80 · 24.4K reputationPosted Sep 26, 2015, 9:04 AM EDT
Reseed the identity Column:
We can also reseed the identity field value. By doing so identity field values will start with a new defined value. This method checks the current identity value for the specified table in SQL Server and, if it is needed, changes the identity value. We use DBCC CHECKIDENT method to manually set a new identity value for the identity column.
/*SET NEW VALUE TO IDENTITY COLUMN*/
DBCC checkident (table_name, RESEED,1000)
Manas MohapatraRank #182 · 13.2K reputationPosted Sep 26, 2015, 8:31 AM EDT
Raja TRank #685 · 3.5K reputationPosted Sep 26, 2015, 6:17 PM EDT
DBCC CHECKIDENT ('your table name', RESEED, 1000);
Above query execute staring I'd 1001 automatically reset....
Sujeet SumanRank #790 · 2.9K reputationPosted Sep 27, 2015, 5:13 AM EDT
Supreeth JRank #2,205 · 639 reputationPosted Sep 27, 2015, 8:32 PM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts