---
schema_version: "1"
id: 4f8352e41eba5ad8c5c0e2e011fb52cff115fa1e3f7e228a53ebe4bad3afce8d
title: ARRAY_PREPEND
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/data-cloud/data-cloud-query-guide/references/data-cloud-sql-reference/scalar-func/array-func/array-prepend.md
canonical_url: https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/array-prepend.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 815cc6ac18dbc9026bb15916ad12a9439357e9f011fbc4f91c58722893e26390
products:
  - Data 360 Query Guide
  - Data 360 Developer Documentation
---
# `ARRAY_PREPEND`

**Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

Inserts a value at the start of an array.

## Syntax

```sql
array_prepend(<value>, <array>)
```

## Arguments

### Required

- `<value>`: The value to insert at the start of the array. The value must match the array element type.
- `<array>`: The array to prepend to.

## Returns

Returns an array with the new value inserted at the beginning.

## Considerations

- Prepending NULL changes the array element type to nullable.

## Examples

### Prepend a Value

Add a value to the front of an array.

```sql
SELECT array_prepend(1, array[2, 3, 4]) AS result;
```

Returns `array[1, 2, 3, 4]`, with 1 inserted at the beginning.

### Prepend NULL

Add a NULL value to the front of an array.

```sql
SELECT array_prepend(null, array[2, 3, 4]) AS result;
```

Returns `array[null, 2, 3, 4]`. Prepending NULL to an array with a non-nullable element type changes the resulting element type to nullable.

## Related Documentation

- [Array Data Type](https://developer.salesforce.com/docs/data/data-cloud-query-guide/datatype/array.md)
