title: out of memory sql execution
body: <p>I have the following script:</p>
  
  <pre><code>SELECT 
      DEPT.F03 AS F03, DEPT.F238 AS F238, SDP.F04 AS F04, SDP.F1022 AS F1022, 
      CAT.F17 AS F17, CAT.F1023 AS F1023, CAT.F1946 AS F1946 
  FROM 
      DEPT_TAB DEPT 
  LEFT OUTER JOIN 
      SDP_TAB SDP ON SDP.F03 = DEPT.F03, 
  CAT_TAB CAT 
  ORDER BY 
      DEPT.F03
  </code></pre>
  
  <p>The tables are huge, when I execute the script in SQL Server directly it takes around 4 min to execute, but when I run it in the third party program (SMS LOC based on Delphi) it gives me the error </p>
  
  <pre><code>&lt;msg&gt; out of memory&lt;/msg&gt; &lt;sql&gt; the code &lt;/sql&gt;
  </code></pre>
  
  <p>Is there anyway I can lighten the script to be executed? or did anyone had the same problem and solved it somehow?</p>