# IS\_UUID

Validates a UUID value.

## Syntax

```sql
IS_UUID(string_uuid)
```

## Arguments

`string_uuid`: A string UUID value.

## Return Type

`TINYINT`: Returns `1` or `0` to indicate `TRUE` or `FALSE`, respectively.

* If the argument is a valid string format UUID value, returns `1`.
* If the argument is not a valid UUID value, returns `0`.
* If the argument is a NULL value, returns SQL `NULL`.

## Remarks

* A UUID is considered valid if it is a 128 bit identifier represented as a 32-character hexadecimal string divided into five fields separated by hyphens in the following format:

  `aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee`

  where,

  * `a` ,`b`,`c`,`d`, and `e` represent hexadecimal characters. Each pair of characters must be in the `00-FF` range.
  * The length (number of characters) and size of each field are as follows:
    | Field  | Length | Size    |
    | ------ | ------ | ------- |
    | Field1 | 8      | 32 bits |
    | Field2 | 4      | 16 bits |
    | Field3 | 4      | 16 bits |
    | Field4 | 4      | 16 bits |
    | Field5 | 12     | 48 bits |
  * Additional valid UUID formats include:

    * A continuous string of hexadecimal characters without hyphens (e.g., `aaaaaaaabbbbccccddddeeeeeeeeeeee`).
    * The format with hyphens, enclosed in curly braces (e.g., `{aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee}`).

## Examples

Returns 1 for a valid UUID value.

```sql
SELECT IS_UUID('e2a2461e-1a08-456b-9eee-cd5dc0998340')
AS result;

```

```output

+------------+
|   result   |
+------------+
|          1 |
+------------+
```

Returns 1 for a valid UUID value.

```sql
SELECT IS_UUID('6701a3357fe041b5aca07f5c21c51dcf')
AS result;


```

```output

+------------+
|   result   |
+------------+
|          1 |
+------------+

```

Returns 1 for a valid UUID value.

```sql
SELECT IS_UUID('{ae0770dd-3d5e-413b-a630-59f2efa3fdd4}')
AS result;


```

```output

+------------+
|   result   |
+------------+
|          1 |
+------------+

```

Returns 0 for an invalid UUID value.

```sql
SELECT IS_UUID('b34a-4666-a35a-6bbbf349') AS result;


```

```output

+--------+
| result |
+--------+
|      0 |
+--------+

```

***

Modified at: November 19, 2024

Source: [/db/v9.1/reference/sql-reference/identifier-generation-functions/is-uuid/](https://docs.singlestore.com/db/v9.1/reference/sql-reference/identifier-generation-functions/is-uuid/)

(An index of the documentation is available at /llms.txt)
