How to Split a String in Snowflake

Last updated July 25, 2026 · By the SaturnSQL team

SPLIT_PART(str, delimiter, n) returns the nth piece of a string, which covers most cases. To get every piece as separate rows, combine SPLIT (which returns an array) with LATERAL FLATTEN.

Grab one piece with SPLIT_PART

Parts are 1-based; negative indexes count from the end.

SELECT
  SPLIT_PART(email, '@', 2) AS domain,
  SPLIT_PART(full_name, ' ', 1) AS first_name
FROM customers;

Split into rows

SELECT c.id, t.value::VARCHAR AS tag
FROM customers c,
  LATERAL FLATTEN(input => SPLIT(c.tags, ',')) t;

SPLIT returns an ARRAY, so a single element can also be picked by index: SPLIT(tags, ',')[0] returns the first element as a VARIANT, which you then cast.

Run this in SaturnSQL

SaturnSQL is a browser-based SQL editor for teams: shared query library, schema-aware autocomplete, and scheduled exports to Google Sheets and Slack.

Try it free

Related Snowflake guides

© 2026 Panda Capital Oy Ab. All rights reserved.