AdvancedSplits

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

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

Syntax:

SELECT *
FROM SQLHTTP.net.AdvancedSplits ( @Text, @Delimiter, @IsDelimiterCharArray, @RegexPattern )

Arguments:

Name Type Description
@Text nvarchar(MAX)

String expression containing substrings and delimiters. 

@Delimiter nvarchar(4000)

String of characters used to identify substring limits. 

@IsDelimiterCharArray bit

Boolean expression describing the composition of delimiter composed of more than one character.
0 = Single delimiter composed of a one or more character string.
1 = Multiple delimiters, each composed of a single character. 

@RegexPattern nvarchar(4000) String expression containing a regex expression. See Regular Expression Language – Quick Reference for more information. Even though this parameter is required, a NULL value indicates that no regex expression is to be used.

Table Returned:

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

Sample Usage:

Split by a space character and a simple regex pattern:
Split by a Char Array delimiter:

See Also: