SSIS 2016 - ErrorColumn is 0 (zero)

走远了吗. 提交于 2019-12-24 07:09:24

问题


I have a package with a bunch of oledb Destinations, using SSIS 2016 - which is supposed to show the exact column that generated the error.The ErrorColumn shows (0) zero, therefore I am unable to trap the column that generated the error.

Using the script below (with code that assigns "Unknown column" but it does not help, it just avoids the script fail):

public override void Input0_ProcessInputRow(Input0Buffer Row)
{
    //IDTSComponentMetaData130 componentMetaData = ComponentMetaData as IDTSComponentMetaData130;
    //var component130 = this.ComponentMetaData as IDTSComponentMetaData130;
    //if (component130 != null)
    //{
    //    System.Windows.Forms.MessageBox.Show(component130.GetIdentificationStringByID(Row.ErrorColumn));
    //    Row.ErrorColumnName = component130.GetIdentificationStringByID(Row.ErrorColumn);
    //}
    IDTSComponentMetaData130 componentMetaData = ComponentMetaData as IDTSComponentMetaData130;
    if (componentMetaData != null)
    {
        //
        if (Row.wkpErrorColumn != 0)
            Row.wkpErrorColumnName = componentMetaData.GetIdentificationStringByID(Row.wkpErrorColumn);
        else
            Row.wkpErrorColumnName = "Unknown column";
    }
    else
    {
        Row.wkpErrorColumnName = "Cannot determine";
    }
    Row.wkpErrorDescription = ComponentMetaData.GetErrorDescription(Row.wkpErrorCode);
}

回答1:


In SSIS 2008 (and I believe also SSIS 2016), a zero error column identifies an error that affects the entire row. In the example below, I have created a package that contains only 1 data flow task in the control flow and redirecting all errors and truncations to the error output. Placed a row count task just to have somewhere to send them to. Also placed data viewers in both error flows to see the data coming out of it.

In a package consuming data from a flat file into an OLE DB Destination:

Using these values as input data

And having name as the PK of the table

We get a PK violation, check the error description and the error column

So when the error affects the entire record, it gets an error column value of 0.

Hope this helps.




回答2:


I found that

When the error is generated by the PK, the error affect the entire row, and the error column is 0

When the error is generated by a Fk, The error affect only the column, and you get the error column value different then 0



来源:https://stackoverflow.com/questions/41111264/ssis-2016-errorcolumn-is-0-zero

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!