A colleague of mine (Mattijs ter Heijde) created a simple script to verify Microsoft SQL Server DBCC RESEED does not take existing ID’s into account, here’s the T-SQL Code:

create table #test (id int not null identity(1,1) primary key, t int)
insert #test(t) values(1) -- Id = 1
insert #test(t) values(1) -- Id = 2
insert #test(t) values(1) -- Id = 3
delete #test where Id in (1, 2) – Delete Id 1 and 2
dbcc checkident (#test, reseed, 0) – DBCC RESEED

insert #test(t) values(1) -- Id = 1
insert #test(t) values(1) -- Id = 2
insert #test(t) values(1) -- Id = 3 BOOM!!!!!!!!

drop table #test

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.