This is the best way I could come up with to convert a MySQL GUID/UUID generated by UUID() to a binary(16):
UNHEX(REPLACE(UUID(),'-',''))
And then storing it in a BINARY(16)
Are there any implications of doing it this way that I should know of?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Not many implications. It will slow down the queries a little, but you will hardly notice it.
UNIQUEIDENTIFIERis stored as16-byte binaryinternally anyway.If you are going to load the binary into a client and parse it there, note the
bit order, it may have other string representation than the initialNEWID().Oracle‘sSYS_GUID()function is prone to this issue, converting it to a string gives different results on client and on server.