Capture a text file row count and update a SQL header table

  • Hi all,

    I'm brand new to SSIS and am assigned the task of taking a text file (ragged right) and creating a header record from it based on the file name, created date, and row count. The row count is the total number of rows in the text file that created the particular header table row. So, if there are 48 rows in the text file, there will be 1 record added to the header table with a row count value of 48.

    There are really two issues here: how to create a new header row, and how to populate it with the record count. I got the file name from the foreach loop, but I have no idea how to create a header row, get the created date, or get the row count. My first straight-forward approach creates 48 header records instead of 1 and the Row Count Transform always returns 0 (makes you wonder what its purpose in life is). You need a data source, and that's my flat file, but how can I just extract the file info from that without creating 48 rows?

    I looked at the OLE DB Command but that processes every flat file row. I just want to extract the file info, not look at every row. I looked at the Script Component but have no idea how to relate it to variables in the package - it is incredibly non-intuitive and I can't seem to find any help on it via Google.

    If you need any more details about what I'm doing just ask. Any help is much appreciated!

    Thanks,

    Larry

  • Okay, I solved one problem - creating a single record.

    I used a Sort to sort on the first column which is identical for all the records in each text file, then checked delete duplicates. This left just one record.

    However, the file date and record count are still blank and 0 respectively.

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

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