STRING_SPLIT()

This table-valued function splits a string into substrings based on a character delimiter.

Signature

STRING_SPLIT ( string , separator [ , enable_ordinal ] )

Parameters

  • string — An expression of any character type (for example, nvarchar, varchar, nchar, or char).
  • separator — A single character expression of any character type (for example, nvarchar(1), varchar(1), nchar(1), or char(1)) that is used as separator for concatenated substrings.
  • enable_ordinal — Applies to: Azure SQL Database, Azure SQL Managed Instance, Azure Synapse Analytics (serverless SQL pool only), and SQL Server 2022 and later versions

Examples

SELECT value FROM STRING_SPLIT('north,south,east', ',');
value
----------------
north
south
east
SELECT value FROM STRING_SPLIT('Lorem ipsum dolor sit amet.', ' ');
Lorem
ipsum
dolor
sit
amet.
SELECT * FROM STRING_SPLIT('Lorem ipsum dolor sit amet.', ' ', 1);
Lorem|1
ipsum|2
dolor|3
sit|4
amet.|5

Run against SQL Server 16.0.4265.3 on 2026-09-13. This is the output we got, not the documentation’s.

Available on

  • SQL Server 2017 and later
  • Azure SQL Database
  • Azure Synapse Analytics
  • Microsoft Fabric warehouse
  • Fabric SQL database

Signature and description adapted from the Microsoft SQL documentation, used under the CC BY 4.0. SQL Server and Azure are trademarks of the Microsoft group of companies. This page is not affiliated with Microsoft.