Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2006

    Not using an incrementing ID

    I am working on an ordering system, and for the orders table, I didn't want the order ID to start with 1 and auto increment as they are placed. Instead I was going to randomly generate an ID for each order placed, such as: 3029491.

    Would there be an inherient problems to doing such a thing? Is it unwise to do it? Should I still have the ID auto increment and just have another column be an random ID column? Either way, it will always be unique.


  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    Quote Originally Posted by Eiolon View Post
    Would there be an inherient problems to doing such a thing?
    other than that you have to have code in case the random number generates an existing number (so just generate another one), no | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Feb 2004
    In front of the computer
    Until SQL 6.5, random distribution was actively encouraged (this is part of what made GUID values popular). Before you "burn daylight" on finding a mangable solution, I'd suggest that you at least investigate using GUIDs instead of recreating them.

    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Posting Permissions

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