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

# `repeat` 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 the string that repeats `expr` `n` times.

## Syntax

```
repeat(expr, n)
```

## Arguments

* `expr`: A `STRING` expression.
* `n`: An `INTEGER` expression.

## Returns

A STRING.

If `n` is less than 1, an empty string.

## Examples

```sql
> SELECT repeat('123', 2);
 123123
```

## Related functions

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