Pivot results to a column

  • I thought I seen this somewhere but can't seem to find it on the net. Is there a T-SQL function to take the results of one query and pivot them into one column with a delimiter?

    Something like;

    SELECT JOIN(', ',SELECT ProductID from Products) as NewColumn

    Results would look like:

    NewColumn

    34, 56, 58, 9, 45, 89

    Thanks,

    Strick

  • You'll need to write a function to do this. Here's a great ready by Jeff Moden on the subject:

    http://www.sqlservercentral.com/articles/Test+Data/61572/

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply