1. We are not accepting any new account registrations at this time.

How to generate unique identifiers of type [A-Z]{n} for any database using basic SQL statements

Discussion in 'Certifications, eBooks and Tutorials' started by Cristina Botieso, Oct 11, 2019 at 10:37.

Tags:
  1. Cristina Botieso

    Cristina Botieso Registered User

    Joined:
    Dec 31, 2018
    Messages:
    67
    Likes Received:
    786
    This is a brief tutorial that shows how to implement a generator of unique identifiers for any database that allows readcommited isolation.

    The identifiers are strings of the form [A-Z]{n}. Where n is configurable.

    The method used is based on the creation of an auxiliary table that contains the generated identifiers. But this table does not need external maintenance to delete used records, the generation algorithm itself deletes the old records. And it prevents from concurrent transaction problems.

    This link contains the generator source code and a test program
    Hidden Content:
    [HIDDEN CONTENT]
     
    50 people like this.
  2. bl

    blurcode Honorary Member Honorary Member V.I.P DEV Guild

    Joined:
    Nov 18, 2008
    Messages:
    1,190
    Likes Received:
    4,713
    Why don't you use an auto increment field?
     
    1 person likes this.
  3. Cristina Botieso

    Cristina Botieso Registered User

    Joined:
    Dec 31, 2018
    Messages:
    67
    Likes Received:
    786
    The autoincrement fields are specific to each database. The purpose of the method is to generate unique identifiers valid in any data base.