Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2003
    Posts
    21

    Question Unanswered: Auto increment primary keys

    Hi all!

    I have a table where the the primary key is auto-increment, but when I delete all the records, and the I insert a new one, it keeps autoincrementing from the last one before I deleted all the records...
    How can I make to restart the indexes from 1 again???

    Thanks!

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: Auto increment primary keys

    db2 alter table tident alter column <colname> restart with 1

    But, be sure that this change will not affect your data integrity(beyond the scope of DB2)

    HTH

    Cheera

    Sathyaram

    Originally posted by rgarcia
    Hi all!

    I have a table where the the primary key is auto-increment, but when I delete all the records, and the I insert a new one, it keeps autoincrementing from the last one before I deleted all the records...
    How can I make to restart the indexes from 1 again???

    Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •