SSIS XML Source Error - Input string was not in a correct format

1

I have an attribute tlost with the definition below in the XSD file. I have tried both use="required" and use="optional".

<xs:attributeGroup name="defense">
      <xs:attribute name="tlost" use="required" type="xs:decimal"/>
</xs:attributeGroup>

In the XML document I am trying to import I will get a value like the following:

<defense ast="0" category="special_team" tlost="0" int="0"/>

I am executing an SSIS package that takes the tlost value and inserts it into a sql database table. The column in the database table has a datatype of DECIMAL(28,10) and allows nulls.

When I execute the package, the previous values work perfectly and the data is inserted. However, when I get a value where tlost="" in the XML file, the package fails and the record is not inserted.

In the data flow path editor, the data type for tlost is DT_DECIMAL. When I check the Advanced Editor for the XML Source, the Input and Output properties have a data type for tlost as decimal [DT_DECIMAL].

I can't figure out why this is failing. I tried to create a derived column and cast it as a (DT_DECIMAL, 10) data type. That didn't work. I tried to check for a null value and replace with 0 if null, that didn't work. So I just ignored the column all together and in the Derived Column task, I replaced the tlost column value with (DT_DECIMAL, 10) 0 to just insert a 0 value and ignore whatever is in the xml file, and the job still failed with the following error message:

Error: 0xC020F444 at Load Play Summary Tables, XML Source [1031]: The error "Input string was not in a correct format." occurred while processing "XML Source.Outputs[defense].Columns[tlost]".

Error: 0xC02090FB at Load Play Summary Tables, XML Source [1031]: The "XML Source" failed because error code 0x80131537 occurred, and the error row disposition on "XML Source.Outputs[defense].Columns[tlost]" at "XML Source.Outputs[defense]" specifies failure on error. An error occurred on the specified object of the specified component.

Error: 0xC02092AF at Load Play Summary Tables, XML Source [1031]: The XML Source was unable to process the XML data. Pipeline component has returned HRESULT error code 0xC02090FB from a method call.

Error: 0xC0047038 at Load Play Summary Tables, SSIS.Pipeline: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on XML Source returned error code 0xC02092AF. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure.

Please help. I have exhausted everything I can think of to fix this issue. I am processing hundreds of files, and I can't keep fixing bad data files every time this issue occurs.

sql
xml
package
ssis-2012
asked on Stack Overflow May 20, 2016 by Brent • edited Jun 20, 2020 by Community

1 Answer

1

Can you please try these

1 - Change to data type to string in xsd and before loading into tables take care of data type conversion. 2 - If possible generate the xsd by passing your xml and then verify the data type and use it accordingly ...

rest of the xsd can be changed accordingly...

below is screen grab of what I tried. hope it helps![enter image description here]1

answered on Stack Overflow May 21, 2016 by singhswat

User contributions licensed under CC BY-SA 3.0