Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004

    Unanswered: Transpose problem


    I am currently importing an excel table into sql server in the form

    date code header1 header2
    2004 5AX num1 num2
    2004 5AZ num3 num4

    I am reading this into an sql table fine. However I want to convert its format into the following

    date code field value
    2004 5AX header1 num1
    2004 5AX header2 num2
    2004 5AZ header1 num3
    2004 5AZ header2 num4

    The number of header1, header2,..... is dynamic so I cannot hard code the number of headers there are.

    Has anyone got any ideas. I have got some code already which will give me the number of headers there are but that Im afraid is as far as I have got before I get stuck

    Thanks in advance for any help

    Last edited by RichardJones; 02-25-04 at 11:30.

  2. #2
    Join Date
    Nov 2002
    Is the header ro part of the data?

    Also. WHY do you want to do this?

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Feb 2004
    Thanks for the reply

    The header is just the name for each column. I just couldnt think of a better name of it. So for example it could be address1, address2,town, etc It is part of the excel columns but is the name of each column in the sql table

    I need to do this in order to get the data in a correct format so that I can build a cube


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts