Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API
Converts an array to a string using a separator and an optional null indicator.
Syntax
array_to_string(<array>, <separator>[, null_string])
Arguments
Required
<array>: The array to convert.<separator>: The delimiter to insert between elements.
Optional
null_string: The string to use for NULL elements.
Returns
Returns a text value that contains all array elements joined by the separator. Without the optional null_string parameter, NULL elements are omitted from the output.
Examples
Basic Conversion
Convert an array to a semicolon-separated string.
SELECT array_to_string(array[1, 2, 3, NULL], ';') AS result;
Returns '1;2;3', joining all elements with semicolons. The NULL element was ignored because no NULL value was specified.
Handle NULL Elements
Convert an array with NULL values using a custom null indicator.
SELECT array_to_string(array[3, 2, 1, null], '-', 'N/A') AS result;
Returns '3-2-1-N/A', replacing the NULL element with the specified indicator.