Editing
Data type
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== UUID 通用唯一辨識碼、GUID 全域唯一識別碼字串 === [https://zh.wikipedia.org/zh-tw/%E9%80%9A%E7%94%A8%E5%94%AF%E4%B8%80%E8%AF%86%E5%88%AB%E7%A0%81 通用唯一辨識碼 - 維基百科,自由的百科全書]、[https://zh.wikipedia.org/zh-tw/%E5%85%A8%E5%B1%80%E5%94%AF%E4%B8%80%E6%A0%87%E8%AF%86%E7%AC%A6 全域唯一識別碼 - 維基百科,自由的百科全書] * BINARY(16)<ref>[https://stackoverflow.com/questions/412341/how-should-i-store-guid-in-mysql-tables How should I store GUID in MySQL tables? - Stack Overflow]</ref> * VARCHAR(36) or CHAR(36) ==== Store the GUID value ==== <pre> SELECT UUID(); -- 4470beb9-ab1e-11ec-bd92-00155de8c33a INSERT INTO `sometable` (`guid_char`, `guid_binary`) VALUES ( '4470beb9-ab1e-11ec-bd92-00155de8c33a', UNHEX(REPLACE("4470beb9-ab1e-11ec-bd92-00155de8c33a", "-","")) ); </pre> {{exclaim}} Need to replace the - symbol with whitespace from GUID value. Or it will not able to retrieve the GUID value ==== Retrieve the GUID value ==== <pre> SELECT `guid_char`, HEX(`guid_binary`) FROM `sometable`; </pre>
Summary:
Please note that all contributions to LemonWiki共筆 are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
LemonWiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Current events
Recent changes
Random page
Help
Categories
Tools
What links here
Related changes
Special pages
Page information