I have strings that have really only one rule: There will always be a delimiter of '/' with a frequency of 2.
Examples:
1/2/3
111/222222/3
asdf/dd/eds
How can I do this without string_split() or making a new table to split this string into 3?
I've made several attempts, but there is always something slightly incorrect.
Assume for the example below that 'str' is one of the samples mentioned above.
select
substring(str,0,charindex('/',str,0)) as first,
substring(str,charindex('/',str,0) + 1,charindex('/',strcharindex('/',strcharindex('/',str,0) + 1))) as 2nd,
--3rd
See Question&Answers more detail:os