Variable length flat file

  • I have a flat file with comma separated columns (16 columns per record/line)

    but for few records, there are only 4-5 columns, in that case data flow is inserting next row columns instead of null values.

    example:

    flat file:

    1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 --Actual row

    but for some records, there will not be all columns like as follows

    1,2,3,4 ( in this case it is inserting next record columns in the table, for which we need to insert null values for missing columns.

    please help me in this..

  • pulluri1226 (1/3/2013)


    I have a flat file with comma separated columns (16 columns per record/line)

    but for few records, there are only 4-5 columns, in that case data flow is inserting next row columns instead of null values.

    example:

    flat file:

    1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 --Actual row

    but for some records, there will not be all columns like as follows

    1,2,3,4 ( in this case it is inserting next record columns in the table, for which we need to insert null values for missing columns.

    How big a file is it? How many "bad" lines are there? Is it a one time load?

    I'd be tempted to just manually "correct" the source data file. There are many ways, and many tools to do this. I'd open the file in Notepad++, create a macro to fix one of these bad lines, and then run it against the whole file.

    HTH,

    Rob

  • The file size is 100 mb and around 1 million records. And it should be done in automated way.

    thanks

  • I would bet that the file you are working with does not have a CRLF as the record terminator. If the file comes from another platform - it could have just a LF as the record terminator.

    You should be able to modify your file definition and change the record terminator to the appropriate value.

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

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

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