Convert Row values to Columns

  • Hi Guys,

    I have table which retrives values and i want to convert those values to columns but the values are not fixed it may increase.

    example

    ID TEXT

    ------------------------

    1 US

    2 UK

    3 SINGAPORE

    etc....

    Required Result.

    US UK SINGAPORE 'ETC.......

    Please advise for a single query without using any temp tables,SP's or functions others...

    Please advise.

  • Since you're in 2005 - you should look up the PIVOT syntax. It should get you started.

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • Don't double-post.... It doesn't serve any real purpose, other than perhaps frustrating the regulars....

    Thread to be continued over here:

    http://www.sqlservercentral.com/Forums/Topic433813-338-1.aspx

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

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

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