SPLIT_PART

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Splits a string on a delimiter and returns the specified field.

Syntax 

1split_part(<string>, <delimiter>, <field>)

Arguments 

Required 

  • <string>: The string to split.
  • <delimiter>: The delimiter string.
  • <field>: The field number to return (1-based). Negative values count from the end.

Returns 

Returns a text value that contains the specified field.

Considerations 

  • Field indexing is 1-based.
  • Negative field numbers count from the last field backward.
  • Returns an empty string if the field number exceeds the available fields.

Examples 

Extract Field 

Get the second field from a delimited string.

1SELECT split_part('abc~@~def~@~ghi', '~@~', 2) AS result;

Returns 'def'.

Related Documentation 

DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!