Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2002
    Location
    UK
    Posts
    525

    Unanswered: Unique character key

    I need to generate a key that has a length of not more than 4 characters but which will allow for more than 9999 combinations. I can use characters 0-9 and A-Z to give me sufficient combinations but the process for generating it in an SP seems needlessly complex (1 big case statement inside a loop).

    Is there a function that can turn an integer generated by a sequence into a base 36 value or does anyone know of any other method I could use?

    Thanks.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    while there might still be a better approach, you don't need "1 big case statement inside a loop" -- just generate four very large random numbers, divide each by 36, and use the remainders as substring positions into the string 'ABCD...0123456789'

    rudy
    http://rudy.ca/

Posting Permissions

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