Hi,@ahmed salah
Welcome to Microsoft T-SQL Q&A Forum!
If you want to continue inserting data in the future, and use“|” as the separator, then I provide a third different way of writing, and add new data to my sample data to test the results,
please see:
create table #ChemicalConfilict
(
NULLflag varchar(300),
)
insert into #ChemicalConfilict(NULLflag)
values
('REACH Version|REACH Version|REACH|adfds|sdfadgqer')
select * from #ChemicalConfilict
SELECT Split.a.value('.', 'VARCHAR(100)') AS functionname
FROM (SELECT
CAST ('<M>' + REPLACE(NULLflag, '|', '</M><M>') + '</M>' AS XML) AS String
FROM #ChemicalConfilict) AS A
CROSS APPLY String.nodes ('/M') AS Split(a);
Best regards,
Bert Zhou
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.