Reputation: 2529
I generate UUID
using INSERT INTO tbl1 (key, val) VALUES (UUID(), :value)
directly on MySQL using PDO. I don't have any idea how to remove those - (dashes) on MySQL side, on PHP side I can simply remove it using str_replace()
.
Upvotes: 10
Views: 14291
Reputation: 1236
REPLACE(UUID(),'-','')
You don't need the UNHEX, just simply replace the hyphens.
Upvotes: 25
Reputation: 5724
to get decimal value for placing into some integer field use
UNHEX(REPLACE(UUID(),'-',''))
Upvotes: 1