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

# `translate` 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

Returns an `expr` where all characters in `from` have been replaced with those in `to`.

## Syntax

```
translate(expr, from, to)
```

## Arguments

* `expr`: A `STRING` expression.
* `from`: A `STRING` expression consisting of a set of characters to be replaced.
* `to`: A `STRING` expression consisting of a matching set of characters to replace `from`.

## Returns

A `S`TRING\`.

The function replaces all occurrences of any character in from with the corresponding character in to.

If `to` has a shorter length than `from` unmatched characters are removed.

## Examples

```sql
> SELECT translate('AaBbCc', 'abc', '123');
 A1B2C3

> SELECT translate('AaBbCc', 'abc', '1');
 A1BC

> SELECT translate('AaBbCc', 'abc', '');
 ABC

> SELECT translate('AaBbCc' COLLATE UTF8_LCASE, 'abc', '123');
 112233
```

## Related functions

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