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

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

Transforms values in a map in `expr` using the function `func`.

## Syntax

```
transform_values(expr, func)
```

## Arguments

* `expr`: A MAP expression.
* `func`: A lambda function.

## Returns

A MAP where the values have the type of the result of the lambda functions and the keys have the type of the `expr` MAP keys.

The lambda function must have 2 parameters.
The first parameter represents the key.
The second parameter represents the value.

The lambda function produces a new value for each entry in the map.

## Examples

```sql
> SELECT transform_values(map_from_arrays(array(1, 2, 3), array(1, 2, 3)), (k, v) -> v + 1);
 {1 -> 2, 2 -> 3, 3 -> 4}
> SELECT transform_values(map_from_arrays(array(1, 2, 3), array(1, 2, 3)), (k, v) -> k + v);
 {1 -> 2, 2 -> 4, 3 -> 6}
```

## Related functions

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