title: SSIS XML Source Error - Input string was not in a correct format
body: <p>I have an attribute tlost with the definition below in the XSD file.  I have tried both <code>use=&quot;required&quot;</code> and <code>use=&quot;optional&quot;</code>.</p>
  <pre><code>&lt;xs:attributeGroup name=&quot;defense&quot;&gt;
        &lt;xs:attribute name=&quot;tlost&quot; use=&quot;required&quot; type=&quot;xs:decimal&quot;/&gt;
  &lt;/xs:attributeGroup&gt;
  </code></pre>
  <p>In the XML document I am trying to import I will get a value like the following:</p>
  <pre><code>&lt;defense ast=&quot;0&quot; category=&quot;special_team&quot; tlost=&quot;0&quot; int=&quot;0&quot;/&gt;
  </code></pre>
  <p>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 <code>DECIMAL(28,10)</code> and allows <code>null</code>s.</p>
  <p>When I execute the package, the previous values work perfectly and the data is inserted.  However, when I get a value where <code>tlost=&quot;&quot;</code> in the XML file, the package fails and the record is not inserted.</p>
  <p>In the data flow path editor, the data type for tlost is <code>DT_DECIMAL</code>.  When I check the Advanced Editor for the XML Source, the Input and Output properties have a data type for tlost as decimal <code>[DT_DECIMAL]</code>.</p>
  <p>I can't figure out why this is failing.  I tried to create a derived column and cast it as a <code>(DT_DECIMAL, 10)</code> 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 <code>(DT_DECIMAL, 10)</code> 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:</p>
  <blockquote>
  <p>Error: 0xC020F444 at Load Play Summary Tables, XML Source [1031]: The error &quot;Input string was not in a correct format.&quot; occurred while processing &quot;<code>XML Source.Outputs[defense].Columns[tlost]</code>&quot;.</p>
  <p>Error: 0xC02090FB at Load Play Summary Tables, XML Source [1031]: The &quot;XML Source&quot; failed because error code 0x80131537 occurred, and the error row disposition on &quot;<code>XML Source.Outputs[defense].Columns[tlost]</code>&quot; at &quot;<code>XML Source.Outputs[defense]</code>&quot; specifies failure on error. An error occurred on the specified object of the specified component.</p>
  <p>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.</p>
  <p>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 <code>PrimeOutput()</code>. 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.</p>
  </blockquote>
  <p>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.</p>