I have an ssis package that takes a flat file and dumps it to SQL. During that process, 150 columns need to have '-' and '.' removed from them. I have done this using a Script Transformation.
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
Dim column As IDTSInputColumn90
Dim rowType As Type = Row.GetType()
Dim columnValue As PropertyInfo
For Each column In Me.ComponentMetaData.InputCollection(0).InputColumnCollection
columnValue = rowType.GetProperty(column.Name)
Dim strCol As String = columnValue.GetValue(Row, Nothing).ToString()
If Not String.IsNullOrEmpty(strCol) Then
strCol = strCol.Replace("-", "").Replace(".", "")
columnValue.SetValue(Row, strCol, Nothing)
End If
Next
End Sub
I however get the following error when running it
Object reference not set to an instance of an object.
at ScriptComponent_f20c21e11e3348378ef0bbe6b65e9c05.ScriptMain.Input0_ProcessInputRow(Input0Buffer Row)
at ScriptComponent_f20c21e11e3348378ef0bbe6b65e9c05.UserComponent.Input0_ProcessInput(Input0Buffer Buffer)
at ScriptComponent_f20c21e11e3348378ef0bbe6b65e9c05.UserComponent.ProcessInput(Int32 InputID, PipelineBuffer Buffer)
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.ProcessInput(Int32 inputID, PipelineBuffer buffer)
I can't figure out why this is happening.. Any thoughts?
Edit I've discovered that this line is the problem
Dim strCol As String = columnValue.GetValue(Row, Nothing).ToString()