Collections:
BIN_TO_UUID() - Converting Binary to UUID
How to convert a binary string to a UUID (Universal Unique IDentifier) string using the BIN_TO_UUID() function?
✍: FYIcenter.com
BIN_TO_UUID(bin, swap) is a MySQL built-in function that
converts a given binary value of 128 bits into
a UUID (Universal Unique IDentifier) string.
The swap flag allows you to swap the first part with the second and the third parts
in the UUID string.
For example:
SELECT BIN_TO_UUID(x'12345678901234567890123456789012'); -- +--------------------------------------------------+ -- | BIN_TO_UUID(x'12345678901234567890123456789012') | -- +--------------------------------------------------+ -- | 12345678-9012-3456-7890-123456789012 | -- +--------------------------------------------------+ SELECT BIN_TO_UUID(x'12345678901234567890123456789012', 1); -- +-----------------------------------------------------+ -- | BIN_TO_UUID(x'12345678901234567890123456789012', 1) | -- +-----------------------------------------------------+ -- | 90123456-5678-1234-7890-123456789012 | -- +-----------------------------------------------------+
Reference information of the BIN_TO_UUID() function:
BIN_TO_UUID(bin, swap): uuid
Returns the UUID string converted from the given 128-bit binary string
with the option to swap the first part with the second and the third parts.
Arguments, return value and availability:
bin: Required. The 128-bit binary string to be converted.
swap: Optional. The default is 0. if 1 is specified, the he first part
of the UUID is swapped with the second and the third parts.
uuid: Return value. The converted UUID string.
Available since MySQL 8.0.
⇒ IS_UUID() - Validating UUID String Format
⇐ MySQL Functions on UUID Values
2023-12-08, 1406🔥, 0💬
Popular Posts:
How to run Queries with SQL Server Management Studio Express in SQL Server? 1. Launch and connect SQ...
Is PL/SQL Language Case Sensitive in Oracle? PL/SQL language is not case sensitive: Reserved words a...
How To Calculate DATETIME Value Differences Using the DATEDIFF() Function in SQL Server Transact-SQL...
How To Assign Debug Privileges to a User in Oracle? In order to run SQL Developer in debug mode, the...
How REAL and FLOAT Literal Values Are Rounded in SQL Server Transact-SQL? By definition, FLOAT(n) sh...