Load selected data from .txt file

  • I am loading data from .txt file with selected column only. (4 fields out of 40 fields)

    I had created a .fmt file

    It shows error as invalid column number.

    How to specify field order in .fmt file?

    Its from 1,2,3,4 or column order?

    I need to get 1,5,7,10 column values from file.

    Destination table contains 4 columns as 1,2,3,4 positions only..

  • [font="Arial"]

    Hello,

    Are you restricted to using bcp? Could you use DTS instead as this would be an almost no brainer there.

    If you pull the .fmt file up in an editor, you can see how it's organizing the fields.

    Regards,

    Terry

    [/font]

  • sharma (6/13/2008)


    I am loading data from .txt file with selected column only. (4 fields out of 40 fields)

    I had created a .fmt file

    It shows error as invalid column number.

    How to specify field order in .fmt file?

    Its from 1,2,3,4 or column order?

    I need to get 1,5,7,10 column values from file.

    Destination table contains 4 columns as 1,2,3,4 positions only..

    You're cheating... asking the same question on two different forums and still not providing enough information will not get you an answer any quicker. 😉

    http://www.sqlservercentral.com/Forums/Topic516087-338-1.aspx

    So, here's what you need to do... go back to your other post and attach the first 10 lines of the file along with what the record layout is supposed to be... just like I asked you to there... then, we can answer your question... I know what you're trying to do and I can help, but I need you to attach the data I asked for and to post the record layout (or attach it).

    --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 3 posts - 1 through 2 (of 2 total)

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