UUID_STR Function

Converts any universally unique identifier (UUID) into a well-formed, canonically formatted string like "491bf00b-7166-4c78-be23-4cfc15f72e86".

Syntax

UUID_STR(input)

Parameters

Return Value

The input reformatted into a 36-character string like "491bf00b-7166-4c78-be23-4cfc15f72e86". If input is not a valid UUID, then NULL is returned.

Example

-- These all print the same thing: 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'
PRINT UUID_STR('A0EEBC99-9C0B-4EF8-BB6D-6BB9BD380A11');
PRINT UUID_STR('{a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11}');
PRINT UUID_STR('a0eebc999c0b4ef8bb6d6bb9bd380a11');
PRINT UUID_STR('a0ee-bc99-9c0b-4ef8-bb6d-6bb9-bd38-0a11');
PRINT UUID_STR('{a0eebc99-9c0b4ef8-bb6d6bb9-bd380a11}');

-- Prints 1, because 'foobar' is not a valid UUID.
PRINT UUID_STR('foobar') IS NULL;

-- Prints 1, because the blob returned by ARRAY() is not a UUID.
PRINT UUID_STR(ARRAY(1, 2, 3)) IS NULL;