Home Forums SQL Server 2008 T-SQL (SS2K8) how to show single column value (separated by ;) as multiple columns otherwise null RE: how to show single column value (separated by ;) as multiple columns otherwise null

  • Luis Cazares (10/23/2012)


    That's why I recommended the Splitter. It gives a much simpler and more understandable code.

    I could help with the code, but Asiti should read the articles first.

    I will help Asiti out and post some nice consumable data however i agree with Luis that Asiti should read the articles. DelimitedSplit8k is the way to go to perform the split but i went with a pivot table instead of cross tabs. (accomplishes the same thing just different way it works in the background.)

    ;WITH data AS (

    SELECT 101 AS StudentID, 'EJB;C++;PERL' AS Subject UNION ALL

    SELECT 102,'Dotnet' UNION ALL

    SELECT 103,'Java' UNION ALL

    SELECT 104,'Oracle;Java;Sql' UNION ALL

    SELECT 105,'Sql;SSIS')


    For faster help in answering any problems Please read How to post data/code on a forum to get the best help - Jeff Moden[/url] for the best way to ask your question.

    For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]

    Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
    Jeff Moden's Cross tab and Pivots Part 1[/url]
    Jeff Moden's Cross tab and Pivots Part 2[/url]