How to split text into lines (or words) in Microsoft SQL Server?
I searched and found the new STRING_SPLIT
, but found it actually isn't working as I expected after trying it:
DECLARE @text NVARCHAR(100)
SET @text = 'This is line 1.' + CHAR(13) + 'This is line 2.'
SELECT STRING_SPLIT(@text, CHAR(13));
-- 'STRING_SPLIT' is not a recognized built-in function name.
I.e., the new STRING_SPLIT
is a table instead of a function.
So, how to split text into lines in Microsoft SQL Server?