5 December, 2011
0 Comments
1 category
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
Tags: SQL ServerT-SQL
Category: Uncategorized