Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 How to validate text file without using script tas

Author  Topic 

naresh0407
Starting Member

30 Posts

Posted - 2012-06-16 : 01:07:42
Hi All,

In Script task i am using C# to validate text file.I have 3 rows validating all the rows using C# in scriptask and wrting Logfile and if i get error i am sending mail.

Can i use any other transformation to do this task.

In Footer i have total no datarows count and at the sametime i have 3 datarows and this should match with datarows count..
1st row is header...rows with no 2 is datarow and row with number 3 is footer.Now footer row count is 4 and no of details row is 3.Mismatch so i should send mail or write logfile without using scripttask.



1 date
2 xyz 04042012
2 abc 04032012
2 nnn 33333333
3 4 date



FileReader=New streamreader(LocalFileName)
Newline=FileReader.readline

If Left(NewLine,3)==1
{
Datevlue=XXX;
}

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-06-16 : 09:11:15
i think you can make use conditional task to separate out detail,header etc and then use variables to store count of detail and compare with header count value

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -