Reset AUTO_INCREMENT

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nico v. Rossum

    #1

    Reset AUTO_INCREMENT

    Hi *

    How can reset a auto_incremet collumn so it starts from 1

    TIA

  • John Smith

    #2
    Re: Reset AUTO_INCREMENT

    I came across this same problem in Paul DuBois's excellent book MySQL, pp.
    142 - 143. The process is to drop the auto_increment column and then add it
    back again:

    ALTER TABLE table
    DROP column,
    ADD column INT UNSIGNED AUTO_INCREMENT NOT NULL,
    AUTO_INCREMENT = 1;


    "Nico v. Rossum" <n.vanrossum@ch ello.nl> wrote in message
    news:Gx%jb.2984 36$4w.34099225@ amsnews03.chell o.com...[color=blue]
    > Hi *
    >
    > How can reset a auto_incremet collumn so it starts from 1
    >
    > TIA
    >[/color]


    Comment

    • John Smith

      #3
      Re: Reset AUTO_INCREMENT

      I came across this same problem in Paul DuBois's excellent book MySQL, pp.
      142 - 143. The process is to drop the auto_increment column and then add it
      back again:

      ALTER TABLE table
      DROP column,
      ADD column INT UNSIGNED AUTO_INCREMENT NOT NULL,
      AUTO_INCREMENT = 1;


      "Nico v. Rossum" <n.vanrossum@ch ello.nl> wrote in message
      news:Gx%jb.2984 36$4w.34099225@ amsnews03.chell o.com...[color=blue]
      > Hi *
      >
      > How can reset a auto_incremet collumn so it starts from 1
      >
      > TIA
      >[/color]


      Comment

      Working...