1. No Profile Picture
    Devshed Newbie (0 - 499 posts)
    I want to create a table with a column which is primary key and auto increment. Now is there any way so that I can specify the starting value? (e.g. it starts from 10000)
  2. #2
  3. No Profile Picture
    rod k
    Devshed Newbie (0 - 499 posts)
    Insert a dummy record with the value of n-1 for the auto-increment field (instead of null) where n is the number you wish for the first record. After a legitimate record has been entered using null, you can delete the dummy record.

    MySQL takes the value of the largest field and increments it. If no record exists the largest field is null which is interpreted to be 0. So the first record to be inserted would begin with 1.

Similar Threads

  1. Replies: 6
    Last Post: March 18th, 2004, 06:58 PM
  2. auto increment from one to another
    By gilly136 in forum PHP Development
    Replies: 3
    Last Post: December 8th, 2003, 11:35 AM
  3. delimited file import with auto increment
    By stressmonster in forum MySQL Help
    Replies: 2
    Last Post: October 8th, 2003, 12:21 PM
  4. Auto Increment Question
    By Number Three in forum MySQL Help
    Replies: 1
    Last Post: August 19th, 2001, 03:39 PM
  5. Setting auto increment
    By cube96 in forum MySQL Help
    Replies: 3
    Last Post: March 18th, 2001, 08:45 AM

IMN logo majestic logo threadwatch logo seochat tools logo