USE [tempdb]
GO
CREATE TABLE [dbo].[Test](
[ID] INT IDENTITY(1,1) NOT NULL,
[Name] [varchar](10) NULL
)
INSERT INTO Test (Name)
VALUES('JIM'),('NICK'),('Thomas')
SELECT * FROM test
DELETE FROM test
INSERT INTO Test (Name)
VALUES('Ray'),('Andrew'),('TIM')
SELECT * FROM Test
you would see the id starts FROM 4 ,so do a reseed to get identity back to what ever position we need , i need to start ID with 1 so
DELETE FROM test
DBCC CHECKIDENT ('Test ', RESEED, 0)
GO
INSERT INTO Test (Name)
VALUES('Ray'),('Andrew'),('TIM')
SELECT * FROM test
Thanks
GO
CREATE TABLE [dbo].[Test](
[ID] INT IDENTITY(1,1) NOT NULL,
[Name] [varchar](10) NULL
)
INSERT INTO Test (Name)
VALUES('JIM'),('NICK'),('Thomas')
SELECT * FROM test
DELETE FROM test
INSERT INTO Test (Name)
VALUES('Ray'),('Andrew'),('TIM')
SELECT * FROM Test
you would see the id starts FROM 4 ,so do a reseed to get identity back to what ever position we need , i need to start ID with 1 so
DELETE FROM test
DBCC CHECKIDENT ('Test ', RESEED, 0)
GO
INSERT INTO Test (Name)
VALUES('Ray'),('Andrew'),('TIM')
SELECT * FROM test
Thanks
No comments:
Post a Comment