How to debug script being a part of SSIS project?

2

I have two databases. Source database: http://sdrv.ms/VkX8tj

and star database: http://sdrv.ms/12S7Zkc

I'm transfering data from the 1st to the 2nd, using SSIS project: sdrv.ms/YDUvU4

(can't post 3rd link, sorry for inconvenience)

As You can see, there is an error in my script. It goes "The column has a null value." or to be exact (by a popping window):

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

and (by the output of debugger):

Error: 0xC0047062 at Data Flow Task, Script Component [337]: Microsoft.SqlServer.Dts.Pipeline.ColumnIsNullException: The column has a null value. at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception e) at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.ProcessInput(Int32 inputID, PipelineBuffer buffer) at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostProcessInput(IDTSManagedComponentWrapper100 wrapper, Int32 inputID, IDTSBuffer100 pDTSBuffer, IntPtr bufferWirePacket) Error: 0xC0047022 at Data Flow Task, SSIS.Pipeline: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Script Component" (337) failed with error code 0x80131600 while processing input "Input 0" (347). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.

My script is exactly as templated except of filling out this one function:

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;
}

"The column has a null value" means something but is it input column or output one and which one exactly? How to figure that out?

By the way, please, don't pay attention to content-based value of this project as it's done (well, will be done, I hope) only in educational purposes.

c#
sql-server
visual-studio
ssis
data-warehouse
asked on Stack Overflow Dec 31, 2012 by smsware

1 Answer

4

Looking at your schema, none of the columns seem to allow NULL. Ergo, the value being NULL from a source column would be improbable.

You can redirect the failed rows to a different destination and look at it to identify the offending rows.

Raj

answered on Stack Overflow Dec 31, 2012 by Raj

User contributions licensed under CC BY-SA 3.0