SPLIT()

All functions > STRING > SPLIT()

Returns an array of substrings from a string split by a delimiter.

Signatures

Returns: Array of substrings

SPLIT(string: VARCHAR, delimiter: VARCHAR, [limit: BIGINT]) → ARRAYVARCHAR
sql
ParameterTypeRequiredDescription
stringVARCHARYesString to split
delimiterVARCHARYesDelimiter to split on
limitBIGINTNoMaximum number of splits (optional)

Notes

  • If the delimiter does not appear, the result is a one-element array containing the original string
  • Empty segments between delimiters appear as empty strings in the result
  • Splitting '' with a non-empty delimiter yields ARRAY['']
  • An empty delimiter is invalid and fails when the query runs
  • If either argument is NULL the result is NULL (use NULL(VARCHAR); bare NULL fails inference)
  • A maximum split count (third argument) is only accepted when supported; otherwise omit it (or use SPLIT_PART for one segment)

Examples

FeatureQL
SELECT
    f1 := SPLIT('apple,banana,cherry', ','), -- Basic split
    f2 := SPLIT('one-two-three', '-'), -- Dash delimiter
    f3 := SPLIT('hello world', ' '), -- Space delimiter
    f4 := SPLIT('no delimiter', ','), -- No delimiter found
    f5 := SPLIT('', ','), -- Empty input string
    f6 := SPLIT(NULL(VARCHAR), ',') -- NULL yields NULL
;
Result
f1 ARRAYf2 ARRAYf3 ARRAYf4 ARRAYf5 ARRAYf6 ARRAY
[apple, banana, cherry][one, two, three][hello, world][no delimiter][(empty)]NULL

Last update at: 2026/05/26 17:22:09