I need to extract codes from a string separated by commas.
I have figured out how to extract the first code but i'm struggling trying to figure out how to extract subsequent codes.
Example string:
~R10.4,T85.8,Y83.8,I10X,I25.9,E10.9,Z95.5,Z93.2,Z88.0
Query:
select code_string, substring(code_string, 0, charindex(',',code_string)) as first
FROM TABLE
Returns:
~R10.4
I now need to extract subsequent codes
~R10.4
T85.8
Y83.8
I10X
etc.
any help would be greatly appreciated
I would prefer not to have to create a function if possible