So I have a C# application (VS 2012 with .NET4.5) that builds SSIS (SQL2012) packages programatically. the packages can be opened in the designer and they run fine. However, there is one case that is giving me a problem. I have an OleDb source connected to a table in SQL server. I am using the unpivot task to convert columns in a sparse matrix to an Entity Attribute Value model. So basically, the primary key value of the source table is a pass-through value in the unpivot task, each column is mapped to the destination column, and the attribute id is hard coded as the pivot key. Like i said this works great EXCEPT i came across one column and a table that was null for all the rows in the table. when I run the package, it fails with:
OnError,SERVERNAME,DOMAIN\user,{94E83A3B-5386-4712-BEDC-11E35341675F},{94E83A3B-5386-4712-BEDC-11E35341675F},{3187347C-8D44-4D51-8FDB-B5C4159A58B0},9/14/2012 9:48:02 AM,9/14/2012 9:48:02 AM,-1071607780,0x,There was an error with OLE DB Destination.Inputs[OLE DB Destination Input].Columns[AttributeId] on OLE DB Destination.Inputs[OLE DB Destination Input]. The column status returned was: "The value violated the integrity constraints for the column."
So I set up a data viewer on the data flow and found that the unpivot component was generating rows for every null value. not only that, but the values for the key column and the attribute id (which was hard coded) were also null for all the rows sent from the unpivot to the ole db destination. I manually created a package with an unpivot for just the column in question and got the same result. then I inserted a value for every row in the table and the same package runs fine.
can someone offer any help or advice on what might be causing this?