UUID_TO_BIN

Converts a string UUID value to a binary UUID value.

Syntax

UUID_TO_BIN(string_uuid)

Arguments

string_uuid: A string UUID value.

Return Type

VARBINARY(16)

Remarks

If the argument is an invalid UUID value, it returns SQL NULL.

Examples

Converts the UUID in binary format and returns the binary format in hexadecimal format.

SELECT HEX(UUID_TO_BIN('d93f9a83-e032-4e25-80a6-d67235e68399'))
AS result;
+----------------------------------+
| result                           |
+----------------------------------+
| D93F9A83E0324E2580A6D67235E68399 |
+----------------------------------+

Last modified: November 12, 2024

Was this article helpful?