The question is pretty simple...
I am reading an Oracle table and Writing to a SQL table. One of the fields in the target SQL table has a Foreign Key stating any value that enters that field must be in the referenced code list table. This field is also a nullable field; it allows null values.
When I enter a record into this table, with the value of the field in question being null from WITHIN SQL Server, the records inserts successfully and no problems.
When I run my translation I get the following:
***** |MS SQL Server Writer: Failed to write a feature of type `dbo.COUNTY_BOUNDARY' to the database. Provider error `(-2147217873) The INSERT statement conflicted with the FOREIGN KEY constraint "FK_SOURCE_G__COUNTY_B_SOURCE_G". The conflict occurred in database "CrestwoodPROD_11282012", table "dbo.SOURCE_GCL", column 'CODE'.'. SQL Command `INSERT INTO dbo.ECOUNTY_BOUNDARY] (YEVENT_ID], (EVENT_GUID], EDESCRIPTION], ECOMMENTS], STATE_GCL], [FIPS_CL], ,SOURCE_GCL]) VALUES (?, ?, ?, ?, ?, ?, ?)'
2013-01-11 16:24:38| 1.0| 0.0|WARN |+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2013-01-11 16:24:38| 1.0| 0.0|WARN |Feature Type: `dbo.COUNTY_BOUNDARY'
2013-01-11 16:24:38| 1.0| 0.0|WARN |Attribute(string) : `SOURCE_GCL' has value `'
*******
That contraint I am "Violating" is the Source_GCL field needs to be referencing the Source_GCL table's Code field.
The inserted value that is causing the contraint violation is a null value, and NULL values are allowed for this field ( and this was proven by manually writing to the table within SQL Server).
The question is why is FME not understanding that the value being inserted is a NULL value and not a different value? The warning log above even shows the value as : ** : `SOURCE_GCL' has value `' **.
I do have a Value Mapper in the translation changing 4 values of the same Attribute Type. Based upon how the Value Mapper changes all values that were not listed in the list to the Default Value, I have the Default Value blank. Per FME sources, a blank Default Value sets the remaining values to NULL. So the Source NULL values SHOULD stay NULL through this transformer.
Also, when I write to inspection and look at the value, it is blank, with no spaces. This to me suggests it is still NULL.
Any Thoughts?
Thanks,
Zachary