using bulk insert

  • Hi friends,

    I have a text file having three columns with values. Using Bulk Insert i need to skip the 2nd column values while doing the bulk insert and work with the 1st and 3rd column. This is my project requirement. Pls help me. It is very urgent.

    Thanx

    CRPRAJAN

  • Then, you can do one of two things...

    1.  Import to a 3 column staging table (where you can also validate the data before making it live, good safeguard) and transfer from that... or...

    2.  Make a BCP format file... Books Online explains how to do that quite nicely.

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

  • see

    http://www.nigelrivett.net/SQLTsql/BCP_quoted_CSV_Format_file.html


    Cursors never.
    DTS - only when needed and never to control.

  • crprajan,

    Both Jeff and nigelrivett, have valid approaches. There is also a last option of using DTS/SSIS to transform the data from the flat file to the destination table. Even for this option, I would recommend using a staging table, and then copy the imported data from the staging table to the actual destination table.

    Regards,

    Wameng Vang

    MCTS

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

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