---
title: h3_stringtoh3 function
description: Learn the syntax of the h3\_stringtoh3 function of the SQL language in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/functions/h3_stringtoh3
---

# `h3_stringtoh3` function

**Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime 11.3 LTS and above ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Lakehouse//RT

Converts the input string, which is expected to be a hexadecimal string representing an H3 cell, to the corresponding BIGINT representation of the H3 cell.

## Syntax

```
h3_stringtoh3 ( h3CellIdExpr )
```

## Arguments

* `h3CellIdStringExpr`: A well-formed hexadecimal STRING expression representing a valid H3 cell ID.

## Returns

A value of type BIGINT. The returned value is the BIGINT representation of the input hexadecimal string.

The function returns NULL if the input is NULL.
The function converts the hexadecimal string to the corresponding BIGINT number.
The function does partial validation regarding whether the input argument is a valid H3 cell ID. A necessary, but not sufficient condition for a valid H3 ID is that its value is between `0x08001fffffffffff` and `0x08ff3b6db6db6db6`.
The behavior of the function is undefined if the input cell ID is not a valid cell ID.

## Error conditions

* If the value of `h3CellIdStringExpr` cannot be converted to a BIGINT or if the value corresponds to a BIGINT value that is smaller than `0x08001fffffffffff` or larger than `0x08ff3b6db6db6db6`, the function returns [H3\_INVALID\_CELL\_ID](https://docs.databricks.com/aws/en/error-messages/h3-invalid-cell-id-error-class.md).

## Examples

```sql
-- Simple example
> SELECT h3_stringtoh3('85283473fffffff');
  599686042433355775

-- Input is an invalid H3 cell ID.
> SELECT h3_stringtoh3('0');
  [H3_INVALID_CELL_ID] 0 is not a valid H3 cell ID
```

## Related functions

* [`h3_h3tostring` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/h3_h3tostring.md)
