I want to split values based on multiple values like ',' & 'And', operators. But I used 'And' in split function it is not working, can someone help me to achieve this?
select distinct y.value from history x
cross apply STRING_SPLIT(x.query, ',') y
where lower(rtrim(ltrim(y.value))) not in (
select s.value from keys s cross apply STRING_SPLIT(y.value, 'And') z where lower((s.value)) like lower(rtrim(ltrim(z.value)))
);
Msg 214, Level 16, State 11, Line 23 Procedure expects parameter 'separator' of type 'nchar(1)/nvarchar(1)'.
Sample input Data:
student,teacher,tutor and principle and director
Output:
student
teacher
tutor
principle
director