Link to home
Start Free TrialLog in
Avatar of Member_2_3698648
Member_2_3698648Flag for Australia

asked on

SSIS - Get last line in a flat file

Hi Experts ,

I need to process a file and get the last record and then process it. The last line is like a footer record which i need to match with the rest of the file. I'm just trying to get a handle on the best way to do this,

I thought of storing the information in a record set destination etc, or maybe something similar,

Potentially SSIS might not even be the best tool for the job in this case, maybe a script task instead might be worthwhile.
Avatar of ValentinoV
ValentinoV
Flag of Belgium image

If you've got a way of distinguishing the last row from the others (based on layout), perhaps the principle of splitting the flow can be used here?  Check out this article for details: http://www.sqlis.com/sqlis/post/Handling-different-row-types-in-the-same-file.aspx

If the last row cannot be distinguished, have a look at this method: http://microsoft-ssis.blogspot.com/2011/02/how-to-skip-trailer-records.html
(found through http://social.msdn.microsoft.com/Forums/en-US/sqlintegrationservices/thread/8454da9c-4ed1-4020-bcae-d00e60a8f1b9/)
ASKER CERTIFIED SOLUTION
Avatar of Jared_S
Jared_S

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Member_2_3698648

ASKER

Thanks for these solutions, i will trial each, however i think Jared_S suggested solution might work well,

I think Valentino_V is good, unfortunately, at this point i don't need to process the records in the file, and the associated links are a little overkill (but very interesting reading!) for what i need here.