Create a Coldfusion style uuid with MySQL

Jul 7, 2015 10:04:00 PM

What if you have a Coldfusion application that uses uuid values in the database, but you would like to insert data directly using MySQL? Unfortunately, Coldfusion's createuuid() function creates a 35 character uuid value, while the uuid() function in MySQL creates a 36 character uuid value.

In my case, I wanted to insert uuid values into a Mura CMS table, and I also wanted to keep the uuid values consistent without increasing the character value of the table to 36 to support the MySQL style uuid values.

The difference between the two uuid styles is an additional hyphen in the MySQL generated uuid values. This can easliy be removed using the following functions: