Format of File Before Bulk Insert

  • Hello all,

    I have files that come in everyday that needs to be bulk inserted. Some files do bulk insert fine however they are in the incorrect format. For example, an extra column may be added in the flat file (i.e. extra delimiter) and when it is bulk inserted the two columns will concatenate together.

    My question is what is the best practice to check for the format of the file before I run the bulk insert?

  • John215 - Friday, March 24, 2017 1:45 PM

    Hello all,

    I have files that come in everyday that needs to be bulk inserted. Some files do bulk insert fine however they are in the incorrect format. For example, an extra column may be added in the flat file (i.e. extra delimiter) and when it is bulk inserted the two columns will concatenate together.

    My question is what is the best practice to check for the format of the file before I run the bulk insert?

    The fun way is to do a manual check whilst holding the provider in a headlock in front of a fully loaded, pre-cocked, 3 banded frozen pork chop launcher that has a foot activated trigger. 😉

    Once the preparations above have been completed, import the first row (ostensibly, the header) as a  full line blob and check the header against a known header string stored in the database.  If they differ, stomp on the foot activated trigger. 😉

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

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

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