STRTOUUID Function [String]

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

Syntax

STRTOUUID string-expression ) 

Parameters

Parameter

Description

string-expression

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

Returns

UNIQUEIDENTIFIER

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 SAP Sybase IQ database.

Standards and Compatibility

  • SQL—Transact-SQL extension to ISO/ANSI SQL grammar.

  • Sybase—Not supported by Adaptive Server Enterprise.

Related concepts
Binary Data Types
Related reference
Binary Data Types
NEWID Function [Miscellaneous]
UUIDTOSTR Function [String]
Character Data Types