In sql-server there is function to auto-increment guid fields.
CREATEGUID()
how can I do the same thing in Mysql?
I’m new in database programing.
I want to create primary key field 16byte auto-incremented.
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.
You can create a BEFORE INSERT trigger to check new value for the auto-increment guid field, and if it is NULL, set value = UUID().
This function may be useful too – UUID_SHORT().
UUID_SHORT() – Returns a “short” universal identifier as a 64-bit unsigned integer (rather than a string-form 128-bit identifier as returned by the UUID() function).