Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2016
    Posts
    1

    Unanswered: Generating an alphanumeric sequence

    I need to generate an alphanumeric string sequence using the algorithm:

    Letter - Letter - Number - Number - Letter - Number - Number - Number

    [a-z][a-z][0-9][0-9][a-z][0-9][0-9][0-9]

    For example, the start of the sequence would be AA00A000. The sequence should increment each column in turn. Once you reach AA00A999, the next item in the sequence should be AA00B000. When you reach AA00Z999, the next item in the sequence should be AA01A000, and so on...

    I have found several methods for generating random strings, but none that generate sequential strings.

    I would prefer to do this purely in MySQL, but if that is not possible I could generate it in PHP.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    your best bet of doing this in MySQL would be to use a stored procedure, assuming you are using a version of MySQL that supports SP's or stored functions
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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