autonumber

  • Can anyone let me know if there is a easy way to reset the identity back to 1 ? I know if you delete the field and then set it up again but there must be an easier way.

  • Not sure if this is the best way to do it..but this works..

    select * into #store from {table}

    truncate {table}

    insert

    (non_id fields)

    select {non_id fields} from #store

    HTH


    Mathew J Kulangara
    sqladventures.blogspot.com

  • From SQL Server Books Online...

    DBCC CHECKIDENT ('table_name', RESEED, new_reseed_value)

    Enjoy!

    Andrew

  • An easy way is:

    Set the autonumber (Identity) in off.

    save the table

    Set the autonumber (Identity) in on.

    Save the table.

     

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply