Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It was used for "<a href="http://www.google.co.uk/search?&amp;q=intermediate+materialization" rel="noreferrer">intermediate materialization (Google search)</a>"</p> <p>Good article: <a href="http://sqlblog.com/blogs/adam_machanic/archive/2006/10/03/exploring-the-secrets-of-intermediate-materialization.aspx" rel="noreferrer">Adam Machanic: Exploring the secrets of intermediate materialization</a></p> <p>He even raised <a href="http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=218968" rel="noreferrer">an MS Connect</a> so it can be done in a cleaner fashion</p> <p>My view is "not inherently bad", but don't use it unless 100% sure. The problem is, it works only at the time you do it and probably not later (patch level, schema, index, row counts etc)...</p> <h2>Worked example</h2> <p>This may fail because you don't know in which order things are evaluated</p> <pre><code>SELECT foo From MyTable WHERE ISNUMERIC (foo) = 1 AND CAST(foo AS int) &gt; 100 </code></pre> <p>And this may also fail because</p> <pre><code>SELECT foo FROM (SELECT foo From MyTable WHERE ISNUMERIC (foo) = 1) bar WHERE CAST(foo AS int) &gt; 100 </code></pre> <p>However, this did not in SQL Server 2000. The inner query is evaluated and spooled:</p> <pre><code>SELECT foo FROM (SELECT TOP 100 PERCENT foo From MyTable WHERE ISNUMERIC (foo) = 1 ORDER BY foo) bar WHERE CAST(foo AS int) &gt; 100 </code></pre> <p>Note, this still works in SQL Server 2005</p> <pre><code>SELECT TOP 2000000000 ... ORDER BY... </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload