SO In the project I'm working I'm importing csv files from a dynamic map to a database.
As an extra feauture I made it so that all the lines that are faulty get written into a csv file and all the good lines into another.
So that when correcting not all the lines have to be redone or people have to spend hours finding the correct line.
So I originally did this in SSIS 2012 now I have to remake it in 2008r2,in 2012 if a flat file doesn't receive inputs it isn't written but it seems in 2008r2 it does.
I can't go check the files based on size cause the column headers are already in the file.
So I thought about using a rowcount into a variable and based on that execute a create script, I can create the file however only the last row is written and also how do I access the variables.
The code section that should generate the lines is below & is based off http://agilebi.com/jwelch/2007/06/03/multi-file-output-destination-script-component/
'This method is called once for every row that passes through the component from Input0.
'Example of reading a value from a column in the the row:
' zipCode = Row.ZipCode
'Example of writing a value to a column in the row:
' Row.ZipCode = zipCode
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
Dim column As IDTSInputColumn100
' If Not Row.SERVER = previousValue Then
If Not fileWriter Is Nothing Then
fileWriter = New StreamWriter(targetFolder + fileName + fileCount.ToString() + fileExt, False)
'fileCount += 1
'previousValue = Row.SERVER
.Write(Row.SERVER + delimiter)
.Write(Row.STATUS.ToString() + delimiter)
.Write(Row.OU.ToString() + delimiter)
.Write(Row.OS.ToString + delimiter)
.Write(Row.SP.ToString + delimiter)
.Write(Row.VERSION.ToString() + delimiter)
.Write(Row.INSERVEROU.ToString + delimiter)
.Write(Row.DATEADDED.ToString + delimiter)
.Write(Row.DATECHANGED.ToString() + delimiter)
If Not Row.SERVER = previousValue Then
previousValue = Row.SERVER