Process flat file with header and footer

  • Hi,

    I have a flat file with header and footer. Below requirements has to be ahcived from the file.

    1. avoid duplicate files (combination of fields in header must be unique)

    2.count of records must match with the TotalRecord field in the footer.

    3. then import the recrods in th SQL table.

    How do i achive this. Please help.

  • I would recommend that you take a look at the SSIS script component. You need custom logic and out of the box components cannot provide that kind of processing.

    ---
    SSIS Tasks Components Scripts Services | http://www.cozyroc.com/

  • a) read your flat file in a table (First column a counter, second field a row from your file)

    b) create a variable

    c) fill this variable with the identificator (the combination of fields, you can use substring) with

    a Execute SQL Task ( select substring.... from ... where counter = 1

    d) you must have a protocol table where you save your identificators

    e) Check if your identificator from c) is in the table (select ... from .. where .. = identifcatorvariable). Fill the output in another variable

    f) When you've got a hit, stop processing (before write the identificator in the protocol

    g) similiar processing fore checking the count of the records

    h) truncate the table from a)

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

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