STRTOUUID function [String]

Function

Converts a string value to a unique identifier (UUID or GUID) value.

Syntax

STRTOUUID string-expression ) 

Parameters

string-expression A string in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Example

CREATE TABLE T (
 pk uniqueidentifier primary key,
 c1 int); 
INSERT INTO T (pk, c1)
 VALUES (STRTOUUID
 ('12345678-1234-5678-9012-123456789012'), 1);

Usage

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, NULL is returned.

You can use STRTOUUID to insert UUID values into a Sybase IQ database.

Standards and compatibility

See also

“NEWID function [Miscellaneous]”

“UUIDTOSTR function [String]”

UNIQUEIDENTIFIER in “Binary data types”