October 17, 2005 at 3:22 am
Hi there,
I have a DTS Package that picks up a number of text files and loads them into a database.(so far so good)
However, I want to perform some basic validation on the file before I decide to load it. All I really need to check for is whether the file has a header and a footer.
I can check the header by using a TextStream.Read(3) as I know the first 3 characters of the file will be 'HDR'. But how do I check to see if the file has a footer?
I thought I could use textStream.SkipLine to go to the last line of the file... but how do I know how many lines I have to skip?
I'd appreciate any help.
Regards
David
October 17, 2005 at 6:51 am
In a Do ..Loop read until AtEndOfStream In the loop store each line into a variable. After the loop ends, read the the last line to check for Footer details.
October 17, 2005 at 7:01 am
SqlJunkie beat me to the punch
As an alternative why not load the data into a staging table (with rowid IDENTITY column) then you can check the data by reference rowid=1 and rowid=MAX(rowid)
Far away is close at hand in the images of elsewhere.
Anon.
October 18, 2005 at 7:08 am
Went with the AtEndOfStream solution at the end and it works fine.
Thank's guy's... much appreciated.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply