uuid() function in MySQL returns a 36 character
hex string, formatted as:
createUUID() function returns a 35
character hex string formatted as:
Both store the same amount of data (16 bytes), the only difference is that there is an extra dash in the MySQL uuid() function result.
Here's some SQL I came up with to create a UUID using ColdFusion's formatting in raw SQL:
SELECT upper(concat(left(uuid(), 23), right(uuid(), 12)))
It is not an ideal solution because I am actually calling
uuid() twice, but it is sufficient for my use case.
You could probably use a regex to remove the extra dash and avoid
calling uuid twice if you wanted to try and optimize it. Feel
free to post a comment if you can come up with a better way to do
Now suppose you …[Read more]