SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2004
    Location
    belfast
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Random new id - SQL

    Hi all,
    i'm developing a database which needs a random unique 8 digit id when a new record is inserted. I could have sworn i've seen something in SQL server to do this.

    Any help would be much appreciated.

  2. #2
    SitePoint Guru
    Join Date
    Oct 2004
    Location
    uk
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can use md5($string) function in php.

  3. #3
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,016
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    you could use sql server's RAND() function which generates a random float number between 0 and 1, then multiply it by 100000000 to get your 8-digit number
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

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