Splits

Splits a string into one or more substrings and returns a table (Simple Version)

  • Free Function
  • SQL Server Compatibility: 2008, 2012, 2014, 2016, 2017

Syntax:

SELECT *
FROM SQLHTTP.net.Splits ( @Text, @Delimiter )

Arguments:

Name Type Description
@Text nvarchar(MAX) String expression containing substrings and delimiters.

 

@Delimiter nvarchar(4000) String of characters used to identify substring limits.

Table Returned:

Column name Data type Description
RowID int Item Index
Text nvarchar(MAX) Item Content
StartPosition int Start Position

Sample Usage:

Simple split by a space character:
Simple split by a two-character delimiter:

See Also: