Converts a string value to a unique identifier (UUID or GUID) value.
Not needed in newer databases
In databases created before version 9.0.2, the UNIQUEIDENTIFIER data type was defined as a user-defined data type and the STRTOUUID and UUIDTOSTR functions were needed to convert between binary and string representations of UUID values.
In databases created using version 9.0.2 or later, the UNIQUEIDENTIFIER data type was changed to a native data type and SQL Anywhere carries out conversions as needed. You do not need to use STRTOUUID and UUIDTOSTR functions with these versions.
For more information, see UNIQUEIDENTIFIER data type.
STRTOUUID( string-expression )
string-expression A string in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx .
Converts a string in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx , where x is a hexadecimal digit, to a unique identifier value.
If the string is not a valid UUID string, a conversion error is returned unless the conversion_error option is set to OFF, in which case it returns NULL.
This function is useful for inserting UUID values into a database.
This function supports NCHAR inputs and/or outputs.
SQL/2003 Vendor extension.
CREATE TABLE T1 ( pk UNIQUEIDENTIFIER PRIMARY KEY, c1 INT ); INSERT INTO T1 ( pk, c1 ) VALUES ( STRTOUUID('12345678-1234-5678-9012-123456789012'), 1 );