July 5, 2008 at 4:46 am
Hi
In a table, i am having identity values of 200.
I am deleting all the records.
I need to insert values from 1.
Without droping table, how to starts from 1.
July 5, 2008 at 5:53 am
July 7, 2008 at 5:52 am
Hi Sharma,
If you are deleteing all the records then TRUNCATE is the Best option.
But If you want to change the IDENTITY value without deleting records then it can be done by two ways:
First Method:
DBCC CHECKIDENT ('TableName', RESEED, Integer) -- Integer means any value like 200
GO
Second Method:
SET IDENTITY_INSERT ON
GO
--Now insert your required value
SET IDENTITY_INSERT OFF
GO
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply