Kriss Jessop About Me Projects Personal Projects RPGs

Unique Strings – SQL

Posted on February 6th, 2018

On occasion a unique string with a database entry can be a very useful way of indexing a table that constrains to either a character limit, or hides the number of entries in the table. Here’s a couple of ways this can easily be done.


The likelihood of repetition with a UUID (or GUID) is so infinitesimally small, and so easily available using SQL that if all you need is a unique identifier then this is what you want. The trade-off is it’s length. A UUID is a 32-digit hex-number, so it’s not always useful when trying to create something like a URL shortener or have non-incrementing identifiers.