How to reset the IDENTITY values?

  • 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.

  • Use the TRUNCATE TABLE command

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • 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