我有两个数据库。源数据库: http ://sdrv.ms/VkX8tj
和星数据库: http ://sdrv.ms/12S7Zkc
我正在使用 SSIS 项目将数据从第一个传输到第二个:sdrv.ms/YDUvU4
(无法发布第三个链接,不便之处敬请见谅)
如您所见,我的脚本中有错误。它是“该列有一个空值”。或者确切地说(通过弹出窗口):
在 Microsoft.SqlServer.Dts.Pipeline.PipelineBuffer.CheckStatusAndNull(Int32 columnIndex) 在 Microsoft.SqlServer.Dts.Pipeline.PipelineBuffer.GetDecimal(Int32 columnIndex) 在 ScriptMain.Input0_ProcessInputRow(Input0Buffer Row) 在 UserComponent.Input0_ProcessInput(Input0Buffer Buffer) 在 Microsoft .SqlServer.Dts.Pipeline.ScriptComponent.ProcessInput(Int32 InputID,PipelineBuffer 缓冲区)在 Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.ProcessInput(Int32 inputID,PipelineBuffer 缓冲区)
和(通过调试器的输出):
错误:数据流任务中的 0xC0047062,脚本组件 [337]:Microsoft.SqlServer.Dts.Pipeline.ColumnIsNullException:列具有空值。在 Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception e) 在 Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.ProcessInput(Int32 inputID, PipelineBuffer 缓冲区) 在 Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostProcessInput(IDTSManagedComponentWrapper100 包装, Int32 inputID, IDTSBuffer100 pDTSBuffer, IntPtr bufferWirePacket) 错误:0xC0047022 在数据流任务,SSIS.Pipeline:SSIS 错误代码 DTS_E_PROCESSINPUTFAILED。处理输入“输入 0”(347) 时,组件“脚本组件”(337) 上的 ProcessInput 方法失败,错误代码为 0x80131600。已识别的组件从 ProcessInput 方法返回错误。该错误是特定于组件的,但该错误是致命的,将导致数据流任务停止运行。在此之前可能会发布错误消息,其中包含有关失败的更多信息。
我的脚本与模板完全相同,只是填写了这一功能:
public override void Input0_ProcessInputRow(Input0Buffer Row)
{
decimal WorkerWage = Row.Amount * Row.HourWage * Row.ProductionHours;
Row.WorkerWage = WorkerWage;
decimal TotalProductionCost = Row.Amount * Row.ProductionHours * (Row.ProductionCost + Row.HourCost) + WorkerWage;
Row.TotalProductionCost = TotalProductionCost;
decimal StandardPrice = TotalProductionCost * (1 + Row.Profit/100);
Row.StandardPrice = StandardPrice;
decimal TotalDiscount = StandardPrice * (Row.Discount / 100);
Row.TotalDiscount = TotalDiscount;
decimal TotalPrice = StandardPrice - TotalDiscount;
Row.TotalPrice = TotalPrice;
decimal TotalShippingCost = Row.ShippingCost + TotalPrice * (Row.ShippingTax / 100);
Row.TotalShippingCost = TotalShippingCost;
decimal RealProfit = TotalPrice - TotalProductionCost;
Row.RealProfit = RealProfit;
decimal TraderMargin = RealProfit * (Row.ProfitMargin / 100);
Row.TraderMargin = TraderMargin;
}
“该列有一个空值”意味着什么,但它是输入列还是输出列,究竟是哪一个?如何弄清楚?
顺便说一句,请不要关注这个项目基于内容的价值,因为它已经完成(我希望将会完成)只是为了教育目的。