ARRAY_COMPACT
functionsupportedCore SQL functionsReturns a compacted array with missing and null values removed, effectively converting sparse arrays into dense arrays.
Syntax
ARRAY_COMPACT( <array1> )
Parameters
| Name | Required | Description |
|---|---|---|
array1 | required | The source array. |
Usage notes
- Semi-structured data (e.g. JSON data) can contain explicit null values, which are distinct from SQL NULLs. A null value in semi-structured data indicates a missing value.
- array1 should be either an ARRAY data type or a VARIANT data type containing an array value.
- If the argument is NULL, the result will be NULL.
- When you pass a structured array to the function, the function returns a structured array of the same type.