ARRAY_GET Function

Retrieves an element at a specified index in an array.

Syntax

ARRAY_GET(array, element-index)

Parameters

Return Value

The specified array element, or NULL if the index is outside the bounds of the array.

Example

DECLARE @a = ARRAY(1, 2, 3);
PRINT ARRAY_GET(@a, 2); -- "3"
DECLARE @b = ARRAY_GET(@a, 10); -- @b is NULL
IF @b IS NULL PRINT 'Null!'; -- Prints.

See Also