Comma Separated Value to Multiple Column

0

Please login or register to vote for this query.

(click on this box to dismiss)

Moderators

Q&A for community managers, administrators, and moderators

create table #yourtable
(
value varchar(100)
,columnnames varchar(500)
)

insert into #yourtable select 'Nalla', 'Name'
insert into #yourtable select '30', 'Age'
insert into #yourtable select 'MCA', 'Study'

select Name, Age, Study
from
(
  select value, columnnames
  from #yourtable
) d
pivot
(
  max(value)
  for columnnames in (Name, Age, Study)
) piv;

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results