Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
Converts a unique identifier value (UUID, also known as GUID) to a string value.
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.
UUIDTOSTR( uuid-expression )
uuid-expression A unique identifier value.
Converts a unique identifier to a string value in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where x is a hexadecimal digit. If the binary value is not a valid uniqueidentifier, NULL is returned.
This function is useful if you want to view a UUID value.
SQL/2003 Vendor extension.
The following statement creates a table mytab with two columns. Column pk has a unique identifier data type, and column c1 has an integer data type. It then inserts two rows with the values 1 and 2 respectively into column c1.
CREATE TABLE mytab( pk UNIQUEIDENTIFIER PRIMARY KEY DEFAULT NEWID(), c1 INT ); INSERT INTO mytab( c1 ) values ( 1 ); INSERT INTO mytab( c1 ) values ( 2 );
Executing the following SELECT statement returns all the data in the newly created table.
SELECT * FROM mytab;
You will see a two-column, two-row table. The value displayed for column pk will be binary values.
To convert the unique identifier values into a readable format, execute the following command:
SELECT UUIDTOSTR(pk), c1 FROM mytab;
The UUIDTOSTR function is not needed for databases created with version 9.0.2 or later.
|Discuss this page in DocCommentXchange.
Send feedback about this page using email.
|Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1|