2011-05-31 31 views
0

嗨,我在將數據從table1(stg)粘貼到table2(std)的同時產生以下錯誤。在腳本組件中,我試圖在特定列中查找字符串「ABC」,並替換該字符串在腳本組件中使用c#將其設置爲「0.00」。腳本組件中的錯誤

at Microsoft.SqlServer.Dts.Pipeline.PipelineBuffer.CheckStatusAndNull(Int32 columnIndex) 
at Microsoft.SqlServer.Dts.Pipeline.PipelineBuffer.GetDecimal(Int32 columnIndex) 
at Input0Buffer.get_Underlying2() 
at ScriptMain.Input0_ProcessInputRow(Input0Buffer Row) 
at UserComponent.Input0_ProcessInput(Input0Buffer Buffer) 
at UserComponent.ProcessInput(Int32 InputID, PipelineBuffer Buffer) 
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.ProcessInput(Int32 inputID, PipelineBuffer buffer) 

但是這裏顯示的錯誤是針對某些其他列(Underlying2).Error說該列有空值。 我已經將約束條件應用爲cleanbuffer.column_isnull = true; 它仍然顯示相同的錯誤。

請幫助解決上述問題。我是新來的C#編碼。

謝謝。

回答

0

爲什麼不在派生列中執行此操作?

ISNULL(STD)== NULL TRUE(DT_STR,10,1252):替換(STD, 「ABC」, 「0.00」)

上面一行說 「如果列STD爲null,則返回null,否則返回字符串,用ABC替換爲0.00「

有一點需要注意。在這個例子中,我假定字符串是char(10)..用適當的大小替換10。