MidTexts

Returns a table of strings extracted from another string based on adjoining strings

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

Syntax:

SELECT *
FROM SQLHTTP.net.MidTexts ( @Text, @Start, @End )

Arguments:

Name Type Description
@Text nvarchar(MAX) String expression to extract from
@Start nvarchar(MAX) String preceding the substring to be retrieved
@End nvarchar(MAX) String proceeding the substring to be retrieved

Table Returned:

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

Sample Usage:

Retrieving text surrounded by double brackets:

See Also: