ARRAY_INSERT Function

Creates a new array by copying an existing array and inserting one or more elements. The existing array is not modified.

Syntax

ARRAY_INSERT(array, element-index, value1, [value2], ...)

Parameters

Return Value

The new array, with the new values inserted at index element-index.

Example

DECLARE @a = ARRAY(111, 222, 333);
DECLARE @b = ARRAY_INSERT(@a, 2, 999);
PRINT @a; -- "[111, 222, 333]"
PRINT @b; -- "[111, 222, 999, 333]"

See Also