将值分配给SSIS脚本组件新的“输出"列 [英] Assign value to SSIS Script Component new Output Column
本文介绍了将值分配给SSIS脚本组件新的“输出"列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我确定这是一个简单的问题,但是我试图将2列合并到一个新的输出列中,但是还没有运气.每次我得到对象引用未设置为对象的实例"时.错误
I'm sure this is a simple issue, but I'm trying to combine 2 columns into a new output column, but have not had any luck with it. Each time I get an 'Object reference not set to an instance of an object.' error
这是我的代码:
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
Public Class ScriptMain
Inherits UserComponent
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
'
' Add your code here
'
Dim tmpStr As String
tmpStr = ""
If Not IsNumeric(Row.addrmap.ToString) Then
tmpStr = Row.addrmap.ToString.Substring(Row.addrmap.ToString.Length - 2, 1)
tmpStr = Row.addrmap.ToString.Remove(Row.addrmap.ToString.Length - 2, 1).PadLeft(3, CChar("0")) & " " & tmpStr.PadLeft(3, CChar("0")) & " " & Row.addrpar.ToString
Else
tmpStr = Row.addrmap.ToString.PadLeft(3, CChar("0")) & " " & "000 " & Row.addrpar.ToString
End If
Row.addrMapPar = tmpStr
End Sub
End Class
感谢您的帮助!
推荐答案
我发现了问题!它与数据中的NULLS有关.我没有提供数据,我只是在解析它,发现有一些我不知道的NULL.
I figured out the issue! It had to do with NULLS in the data. I didn't provide the data, I was just parsing through it and found that there were some NULLs I didn't know about.
要修复它,我使用了:
If Row.addrmap_IsNull = False and Row.addrpar_IsNull = False Then
...
End If
这篇关于将值分配给SSIS脚本组件新的“输出"列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文