select PID, SUBSTRING(a.KOrderID,number,CHARINDEX(',',a.KOrderID+',',number)-number) as KOrderID from TB a,master..spt_values
where number >=1 and number<=len(a.KOrderID) and type='p' and substring(','+a.KOrderID,number,1)=',')
select PID, SUBSTRING(a.KOrderID,number,CHARINDEX(',',a.KOrderID+',',number)-number) as KOrderID from TB a,master..spt_values
where number >=1 and number<=len(a.KOrderID) and type='p' and substring(','+a.KOrderID,number,1)=',')