Produces a random universally unique identifier (UUID) as aSTRINGvalue.
GENERATE_UUID
GENERATE_UUID()
Description
Returns a random universally unique identifier (UUID) as aSTRING.
The returnedSTRINGconsists of 32 hexadecimal
digits in five groups separated by hyphens in the form 8-4-4-4-12. The
hexadecimal digits represent 122 random bits and 6 fixed bits, in compliance
withRFC 4122 section 4.4.
The returnedSTRINGis lowercase.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Utility functions in GoogleSQL\n\nGoogleSQL for Spanner supports the following utility functions.\n\nFunction list\n-------------\n\n`GENERATE_UUID`\n---------------\n\n GENERATE_UUID()\n\n**Description**\n\nReturns a random universally unique identifier (UUID) as a `STRING`.\nThe returned `STRING` consists of 32 hexadecimal\ndigits in five groups separated by hyphens in the form 8-4-4-4-12. The\nhexadecimal digits represent 122 random bits and 6 fixed bits, in compliance\nwith [RFC 4122 section 4.4](https://tools.ietf.org/html/rfc4122#section-4.4).\nThe returned `STRING` is lowercase.\n\n**Return Data Type**\n\nSTRING\n\n**Example**\n\nThe following query generates a random UUID. \n\n SELECT GENERATE_UUID() AS uuid;\n\n /*--------------------------------------*\n | uuid |\n +--------------------------------------+\n | 4192bff0-e1e0-43ce-a4db-912808c32493 |\n *--------------------------------------*/"]]