SQLTeam.com | Weblogs | Forums

Split one column into multiple columns comma as delimeter


#1

Please can somebody help

--My result

select 'Consultant fetal cardiac, Detailed scan, Amniocentesis' as Test
union all
select 'Detailed Rhesus scan, Fetal blood sample, Fetal blood transfusion'

--Expected Results
select 'Consultant fetal cardiac' as a, 'Detailed scan' as b, 'Amniocentesis' as c
union all
select 'Detailed Rhesus scan', 'Fetal blood sample', 'Fetal blood transfusion'


#2

You might look into Jeff Moden's DelimitedSplit8K http://www.sqlservercentral.com/articles/Tally+Table/72993/


#3

thanks @djj55