Skip to main content
Participant
Jun 26, 2008 10:33 PM UTC
Question

Handling Strings?

I'm currently working with a database, in which some primary keys are varchars. I'm supposed to make an application that creates an "automatic" primary key for each new register, currently for instance, if the max(pk) is 100, the new one is 101. My question is, how to handle strings in a way in which if max(pk) is abx, I can do abx +1 to get aby - or similar. Any comments?
    This topic is closed to new replies. Start a new post to keep the conversation going.

    2 replies

    Inspiring
    Jul 3, 2008 7:32 AM UTC
    you can also make use of your db capabilities instead of letting cf do the work. try reading the documentation for your db regarding auto create string PK.
    Translate
    Inspiring
    Jun 29, 2008 4:15 PM UTC
    Do the strings have to be sequential in some way or do they simply need to be unique? If it's the latter you could just use the CF function CreateUUID. This will create unique strings for a primary key. Might not fit your needs but could be a quick solution.

    Cheers,
    Craig
    Translate