Converting a Row into Columns

  •  Hi all ,

          Again I am stuck in a very different type of stage.

          Let suppose I have a Table which have only 3 fields i.e. Name, Subject and Marks

          This table will contain only 1 record, i.e.

    Name      Subject       Marks

    Raj          Maths          99

     

    Now I wants to create another temp table which have only 2 fields i.e. ColName and ColValue

    I want to Insert record in this table like

    ColName              ColValue

    Name                  Raj

    Subject                Maths

    Marks                   99

     

    Please help me out

    Raj


    Thanks & Regards,
    Raj

  • You aren't the first to have fun with this, have a look at some of the responses in:

    http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=8&messageid=258150#bm258223

    and see if any of those responses help.

    Steve.

  • If you are prepared to do this manually and there is not a lot of data, you can use excel.

    Select a row, copy it into excel using paste special / transpose and it transposes it for you.


    ------------------------------
    The Users are always right - when I'm not wrong!

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

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