title: SSIS using too much memory to load large (40GB+) XML file into SQL Server table
body: <p>I need to load a single large (40GB+) XML file into an SQL Server 2012 database table using SSIS. I'm having problems because SSIS seems to be trying to load the entire document in memory instead of streaming it.</p>
  
  <p>Here's more details of my SSIS package.</p>
  
  <p>I've created an XML Source with the folowing properties:</p>
  
  <ul>
  <li>Data access mode: XML file from variable (but could be XML File Location)</li>
  <li>Variable name: variable that specifies the XML file path in my computer.</li>
  <li>XSD location: the path to the XSD that defines the XML being read.</li>
  </ul>
  
  <p>The XML structure is simple, with only 3 hierarchical levels: </p>
  
  <ol>
  <li>Root element with header information</li>
  <li>One level defining collections of objects</li>
  <li>The leaf level defining individual objects (each with a fixed set of fields)</li>
  </ol>
  
  <p>I need to insert one database record per leaf element, repeating fields from the higher hierarchy levels. In other words, I need to flaten the XML hierarchy.</p>
  
  <p><strong>How can I make SSIS stream load the data, instead of trying to load the entire document in memory?</strong></p>