title: SQL Server out of memory
body: <p>I got this error running a query that goes against 2 tables with combined 50k rows.</p>
  
  <pre><code>An error occurred while executing batch. 
  Error message is: Insufficient memory to continue the execution of the program.
  </code></pre>
  
  <p>How do I get around this?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>I get this when I run DBCC MEMORYSTATUS</p>
  
  <pre><code>Msg 2571, Level 14, State 1, Line 1
  User 'XXXX\YYYY' does not have permission to run DBCC memorystatus.
  </code></pre>
  
  <p><strong>New Edit</strong></p>
  
  <p>The server worked fine the next morning without reboots or anything else.</p>