Skip to main content

UUID functions

These apply to MonetDB SQL type: UUID (Universally Unique IDentifiers).

Note: You must include the sys. prefix for these UUID functions (see examples) in order to work properly from other schemas than sys.

Function Return type Description Example Result
sys.isauuid(string) boolean tests if the given string represents a valid uuid value and returns a boolean value true or false, or null when the input is null sys.isauuid('e31960fb-dc8b-452d-ab30-b342723e7565') true
sys.uuid() uuid generates and returns a new random uuid sys.uuid() 65950c76-a2f6-4543-660a-b849cf5f2453

 

To convert a string column or expression or literal (which represents a valid uuid) to a uuid type you can use a cast() or convert() function. Examples:

select  cast('26d7a80b-7538-4682-a49a-9d0f9676b765' as uuid)  as uuid_val;
select convert('83886744-d558-4e41-a361-a40b2765455b', uuid)  as uuid_val;

To convert a quoted string literal which represents a valid uuid to a uuid type you can also use the uuid prefix. Example:

select uuid'AC6E4E8C-81B5-41B5-82DE-9C837C23B40A'  as uuid_val;