You can check this answer in order to learn how to implement and use .net
functions in the context of SQL Server
. Here, I am using SQLSCLR
implementation of the of the .net
Regex.Match
function.
DECLARE @DataSource TABLE
(
[Description] NVARCHAR(MAX)
);
INSERT INTO @DataSource ([Description])
VALUES ('word01, word02, word03, word04, word05, word06')
,('word01,word02, word03, word04, word05, word06')
,('word01!word02, word03: word04, word05, word06');
SELECT *
FROM @DataSource DS
CROSS APPLY [dbo].[fn_Utils_RegexMatches] ([Description], '^(\w+\b.*?){3}') RM;
This gives you the following output:

which is too detailed (and extraging only the first three
words). Your final query can be something like this:
SELECT DS.[Description], RM.[CaptureValue]
FROM @DataSource DS
CROSS APPLY [dbo].[fn_Utils_RegexMatches] ([Description], '^(?n)(\w+\b.*?){3}') RM;

Anyway, using regex you can use the any separators you want, but the more important thing is you can execute .net
code in the context of T-SQL
which is huge.
You have a lot of to read and learn from here. The previous answer is more easy and faster to be implemented.