我需要更改现有的SSIS包以添加新列。此程序包具有比较OLD和NEW值的脚本任务。它给了我低沉的错误。
at ScriptComponent_2dc377607ff1474a82d85cf977045c1c.vbproj.ScriptMain.Input0_ProcessInputRow(Input0Buffer Row) 在ScriptComponent_2dc377607ff1474a82d85cf977045c1c.vbproj.UserComponent.Input0_ProcessInput(Input0Buffer Buffer) 在Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.ProcessInput(Int32 inputID,PipelineBuffer buffer)
这是VB代码:
#Region "Private Constants"
Private Const oldValueTag As String = "OLD"
Private Const newValueTag As String = "NEW"
Private Const nullValueTag As String = "_IsNull"
#End Region
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
Dim column As IDTSInputColumn100
Dim newColumnName As String
Dim rowType As Type = Row.GetType()
Dim newColumnValue As String
Dim oldColumnValue As String
Dim newColumnValueNumber As Double
Dim oldColumnValueNumber As Double
Row.RecordChanged = False
'Loop through list of Input Columns per Row
For Each column In Me.ComponentMetaData.InputCollection(0).InputColumnCollection
'Reset Values to defaults
newColumnValue = ""
oldColumnValue = ""
newColumnValueNumber = 0
oldColumnValueNumber = 0
If column.Name.EndsWith(oldValueTag) Then
'Set NEW column name based on OLD
newColumnName = column.Name.Substring(0, column.Name.IndexOf(oldValueTag)) + newValueTag
'Check if our OLD value is Null - grab value
If CBool(rowType.GetProperty(column.Name & nullValueTag).GetValue(Row, Nothing)) = False Then
oldColumnValue = Trim(rowType.GetProperty(column.Name).GetValue(Row, Nothing).ToString)
End If
If CBool(rowType.GetProperty(newColumnName & nullValueTag).GetValue(Row, Nothing)) = False Then
newColumnValue = Trim(rowType.GetProperty(newColumnName).GetValue(Row, Nothing).ToString)
End If
If Double.TryParse(oldColumnValue, oldColumnValueNumber) And Double.TryParse(newColumnValue, newColumnValueNumber) Then
If Not oldColumnValueNumber = newColumnValueNumber Then
Row.RecordChanged = True
Return
End If
Else
If Not oldColumnValue = newColumnValue Then
Row.RecordChanged = True
Return
End If
End If
End If
Next
End Sub
答案 0 :(得分:0)
您的代码中的假设是inputrow包含每个OLD列的NEW列。我的猜测是你添加了一个没有相应NEW列的OLD列。
您需要传递给
之类的组件
Column1OLD
Column2OLD
Column3OLD
Column1NEW
Column2NEW
Column3NEW
我建议:
1.检查您是否通过了相同数量的旧列和新列 2.检查OLD和NEW列对中是否存在拼写差异。