I'm trying to keep only the yes part of the string:
'C:\Direction\Other\No\No\Yes\Yes\Yes\Yes'
The idea is that in the end I stay:
campo 1 | campo 2 | campo 3 | campo 4 | campo 5
algo | yes | yes | yes | yes
What he says would not rule it out and what he says would go in different fields.
Now, are they different substrings? Or do I have to use a regular expression?
My query is about SQL Server
If I misunderstood your question, it would occur to me that you first do a split by the "\" sign, then you sweep this array of results and before sending them to save valid if the data == 'Yes' you store it, otherwise it discard.
It would be something like this: ( @Text VARCHAR(MAX), @Delimiter CHAR(1) ) RETURNS @output TABLE(Data VARCHAR(MAX) ) BEGIN DECLARE @Begin INT, @End INT SELECT @Begin = 1, @End= CHARINDEX( @Delimiter , @Text ) WHILE @Begin < LEN(@Text ) + 1 BEGIN IF @End = 0
SET @End = LEN(@Text ) + 1
END