SSIS Script task question.
Hi, I am new to SSIS. Not sure where should i ask this question but i am updating the existing SSIS package where it checks the no. of fields. i have following script in script task. In the script below i am checking if the file has 62 fields in it. I just
want to add one more condition for column Date. If the data in Date field in the file is equal to 2012.
Dim fiModifiedDate
As System.IO.FileInfo
Dim dtModifiedTime
As Date
'File modified Date
Dim myStreamReader
As StreamReader
myStreamReader = File.OpenText(Dts.Variables("FilePath_CmsWebEnrollment").Value.ToString)
Dim strColumns As
String() = myStreamReader.ReadLine().Split(CType(vbTab,
Char))
If strColumns.Length = 62
Then
Dts.Variables("FileFormat").Value =
"62"
myStreamReader.Close()
Else
Dts.Variables("FileFormat").Value =
"Invalid"
myStreamReader.Close()
I have an expression set on after Script task as @FileFormat == 62 so i am guessing i should have an expression for that Date field = 2012.
Can anybody tell me how do i update the above script in script task?
Thanks
November 19th, 2011 1:39pm
You need to know what is the location of the column of the date field in the Array (strColumns)
Then insert at the end :
For instance the Date Column is located in 4th column, since array is zero based you would take the 3rd like:
If (strColumns(3) == "2012") Then
'Do something here.
End If
Randy Aldrich Paulo
MCTS(BizTalk 2010/2006,WCF NET4.0), MCPD |
My Blog
BizTalk Message Archiving - SQL and File (http://biztalkarchiving.codeplex.com)
Free Windows Admin Tool Kit Click here and download it now
November 19th, 2011 2:04pm