selectSUBSTRING(a.RetRCode,number,CHARINDEX(',',a.RetRCode+',',number)-number) as name from InRetMatAppH a,master..spt_values where number >=1 and number<len(a.RetRCode) and type='p' and substring(','+a.RetRCode,number,1)=','