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

# `array_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 an array containing `element` `count` times.

## Syntax

```
array_repeat(element, count)
```

## Arguments

* `element`: An expression of any type.
* `count`: An INTEGER greater or equal to 0.

## Returns

An array of the elements of the element type.

Databricks raises [COLLECTION\_SIZE\_LIMIT\_EXCEEDED](https://docs.databricks.com/aws/en/error-messages/collection-size-limit-exceeded-error-class.md) if `count` exceeds the array size limit.

## Common error conditions

* [COLLECTION\_SIZE\_LIMIT\_EXCEEDED](https://docs.databricks.com/aws/en/error-messages/collection-size-limit-exceeded-error-class.md)

## Examples

```sql
> SELECT array_repeat('123', 2);
 [123, 123]
```

## Related functions

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