Challenge - dynamically load any file

  • Hi All,

    I have done this before. The concept is simple, Load the flat file in ragged right format into a table with one filed having n/varchar(max).

    Once its a table, we have many ways to split into columns. One way I used is by using a split function. The performance will be slow. But we can achieve this.

    Regards,

    Vijay

  • vj.one (7/29/2015)


    Hi All,

    I have done this before. The concept is simple, Load the flat file in ragged right format into a table with one filed having n/varchar(max).

    Once its a table, we have many ways to split into columns. One way I used is by using a split function. The performance will be slow. But we can achieve this.

    Regards,

    Vijay

    That works fine if the file "looks" like a table, although that can be a bit slow. It doesn't work so fine for files that look like the following.

    For something like that, even if you bring the raw data into a nice columnar format, it's going to require a bit of work to normalize the data so that it can actually be queried in a useful manner.

    I realize that it might not be an actual spreadsheet that is being imported but it certainly could be a CSV or TSV file that was created from such a thing.

    --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)

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

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