Hi.

On Tue, Feb 27, 2001 at 04:49:33PM -0800, [EMAIL PROTECTED] wrote:
> 
> Can MySQL help with generation of ALPHANUMERIC unique identifiers ?
> 
> ID's that use the full ASCII char range create more possible combinations with the 
>same # of characters which can be important when squeezing into cookie storage space.
> 
> 4 character numeric ID has 10,000 combinations.
> 
> 4 character (6 bits per char) alphanumeric id has 16,777,216 combinations
> 
> If MySQL can't help then I can do it with Perl/PHP I suppose but just curious.

You cannot store the ids that why (neither would it make sense to
waste space this way), but can use a conversion function on
retrievel. I don't know the name from my head, but MySQL has several
functions to convert numbers from one base (e.g. decimal) to another
base (e.g. octal), and also one to convert to abitrary bases. You can
use this latter one to convert the ids the way you want by specifying
a base of 36.

Have a look at the sections about string functions, arithmetic
functions and misc functions. In one of these you should find the
answer.

Bye,

       Benjamin.


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to