kapil_kk (10/22/2012)
Execute this code and you will get duplicate values in Identity values--CREATE TABLE IdentTest
( Ident INT NOT NULL IDENTITY (1,1)
, varfield varchar(100)
)
INSERT INTO IdentTest VALUES ('xyz') -- <== Added to original
INSERT INTO IdentTest VALUES ('123') -- <== Added to original
SELECT Ident FROM IdentTest
-- Result 1,2
DBCC CHECKIDENT ('IdentTest',RESEED,100)
--Checking identity information: current identity value '2', current column value '100'.
INSERT INTO IdentTest VALUES ('abc')
SELECT Ident FROM IdentTest
--Result 1,2,101
DBCC CHECKIDENT ('IdentTest',RESEED,100)
--Checking identity information: current identity value '101', current column value '100'.
INSERT INTO IdentTest VALUES ('abc')
SELECT Ident FROM IdentTest
--Result 1,2,101,101
Its intresting to know that functionality of identity is exploiting in this way
Very true..that's what I was trying to point out:-)
~ Lokesh Vij
Link to my Blog Post --> www.SQLPathy.com[/url]
Follow me @Twitter