Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2008
    Posts
    2

    Semi Automatic Serial (Autoincrement)

    I am stuck with this design requirement:

    In an inventory of tens of thousands of items, we designed the unique ID of each item to be auto-increment (MySQL) - serial in Informix. The requirements have been extended to be able to also assign the ID from a batches of reserved numbers. This is a valid user requirement allowing the use of pre-printed labels on some items.

    You can, of course, enter and ID into an auto-increment field, providing it does not exist, but it alters the next auto increment value. That, in turn, causes "strange" sequencing in the database.

    Our ID is integer.

    Anyone with any experience in doing this?

    Thanx

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    My experience always says: auto incrementing primary keys have no values. Therefore it should not matter a toss if there are "gaps" in your sequencing
    George
    Home | Blog

  3. #3
    Join Date
    Mar 2008
    Posts
    2
    Quote Originally Posted by georgev
    My experience always says: auto incrementing primary keys have no values. Therefore it should not matter a toss if there are "gaps" in your sequencing
    Yes, that is a valid concept. Would you then suggest we have a separate field for the actual inventory number or just number inventory in a random-incremental fashion?

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    i would just number inventory items in a unique fashion

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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