SQL Server Performance

Indentity Problem - Spanish Forum

Discussion in 'SQL Server DTS-Related Questions' started by Luis Martin, Jun 17, 2004.

  1. Luis Martin Moderator


    One member, spanish forum, has the following problem.

    He insert one table with many rows. That table has identity column.
    Each day he delete all rows and insert again using DTS.
    SQL begin inserting with the last id after delete. He need to begin with id = 1 each time.

    Is there any way, beside SET IDENTITY_INSERT table ON each time using DTS?



    Luis Martin
    Moderator
    SQL-Server-Performance.com

    All postings are provided “AS IS” with no warranties for accuracy.

  2. satya Moderator

    If the table is TRUNCATED with TRUNCATE TABLE... statement then the identity value will start from start again.

    HTH

    Satya SKJ
    Moderator
    http://www.SQL-Server-Performance.Com/forum
    This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
  3. Luis Martin Moderator

    Thanks, this is the solution.


    Luis Martin
    Moderator
    SQL-Server-Performance.com

    All postings are provided “AS IS” with no warranties for accuracy.

  4. Raulie New Member

    Truncating works faster since it is not logged, however if recovery is a high priority I recommend using delete the applying this command.

    DBCC CHECKIDENT(MyTable,RESEED,0)

    which will reset the identity column back to 1 [8D]
  5. Luis Martin Moderator

    Yes, Raulie (ex-Lazy), I allready read your answer in spanish forum, thanks.


    Luis Martin
    Moderator
    SQL-Server-Performance.com

    All postings are provided “AS IS” with no warranties for accuracy.

Share This Page