CREATE TABLE IdentTest (Ident INT NOT NULL IDENTITY (1,1), varfield varchar(100))
INSERT INTO IdentTest VALUES ('abc')
DBCC CHECKIDENT ('IdentTest',RESEED,100)
-- here 100 starts identity from 101 if is there any data in table otherwise it starts from 100, for 1 you have to use 0
INSERT INTO IdentTest VALUES ('def')
SELECT * FROM IdentTest
--Note: if the inserting with already existing identity, then it will raise the error.
--****first POST of the Year
No comments:
Post a Comment