title: Error While Inserting large amount of data using Insert statement in SQL Server 2008
body: <p>I am trying to insert records into table have large amount of data</p>
  
  <p><b>File Description:</b></p>
  
  <pre><code>Size : 65.0 MB
  Records count : 10000
  </code></pre>
  
  <p><b>My Sample Data:</b></p>
  
  <pre><code>INSERT INTO tbldata(col1,col2,col3)values(col1,col2,col3)
  GO
  INSERT INTO tbldata(col1,col2,col3)values(col1,col2,col3)
  GO
  INSERT INTO tbldata(col1,col2,col3)values(col1,col2,col3)
  GO
  INSERT INTO tbldata(col1,col2,col3)values(col1,col2,col3)
  GO
  .......
  INSERT INTO tbldata(col1,col2,col3)values(col1,col2,col3)
  GO
  INSERT INTO tbldata(col1,col2,col3)values(col1,col2,col3)
  GO 
  .......
  UPTO 10000 ROWS
  </code></pre>
  
  <p><b>ERROR:</b></p>
  
  <pre><code>Exception of type 'System.OutOfMemoryException' was thrown.(mscorlib)
  </code></pre>
  
  <p><b>I Tried:</b>
  <a href="https://stackoverflow.com/questions/1795074/inserting-1000s-of-rows-to-sql-table-using-ssms">I verified this answer</a></p>
  
  <p>Under SQL Server\Properties\Memory there is a setting for Minimum Memory Per Query. you can raise this number temporarily to help increase the number of records between the GO statements. In my case I raised this to 5000 (10000 caused a system out of memory error, not good) so I settled for 5000, after a few tests I found that I could now import about 20,000 rows so I placed a GO statement every 20,000 rows (took about 10 minutes) and I was able to import over 200,000 rows in one query.</p>