Removing header and footer from a file?

  • I have a file that contains three areas (header, data and footer) but I only need the data part.

    The file is in Unix format and is not delimited so I should use the fixed size (to measure the bytes). According to specifications I know that the header is the first 106 bytes and the footer has 120. The rest is the data that I want to store in a table.

    My problem lies in trying to read from the file, ignoring the header. Since the header has a different length than the data, I cannot use the "Header rows to skip" option. If I mark the rows being 106 bytes long, I cut the data field... and if I define 120, I have data being left in the first column (witch should only contain the header).

    Ex:

    1212121223232

    ghkjlklkjhgfdgghjklçkjhgf

    12121

    In this example the numbers are header and footer and letters are data.

    My idea would be to discard the first line (regardless of the size) but I don't have the delimiter... that's my BIG problem.

    Any thoughts would be very much appreciated,

    Thanks in advance,

    Bruno Pimenta

  • You could store the data in an intermediate table with a VARCHAR(max) column and use the WRITE function to get rid of the first and last character.

    Then split the remaining text.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

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

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