DTS Import data from Excel changing columns and rows

  •  How do I import data from excel via DTS but importing the columns as rows and rows as the columns?

  • Dunno... If faced with such a problem, I'd have the spreadsheet do a transpose and write to a text file for me... then, I'd import the text file using Bulk Insert or BCP.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

  • I do this every week, I use an Access project FE where I use ADO code to convert from columns to rows. Try not to refer to your columns directly except for key columns use a numerical index i.e rst(i) where i is a for next variable, that way makes the code flexible and if the number of columns are extended then your time amending the code will be drastically reduced.

     

    Being a programmer I always opt for the easy solution. Ican be done with a query/view for each column but this approach is very inflexible.

  • Did somebody try to play with PIVOT and UNPIVOT in SQL Server 2005? You probably can UNPIVOT the original data and then PIVOT them differently.

    Regards,Yelena Varsha

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

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