It was used for intermediate materialization (Google search) "
Good article: Adam Machanic: Learning the Secrets of Intermediate Materialization
He even picked up MS Connect so that it could be done in a cleaner way.
My opinion is "not inherently bad," but do not use it if you are not 100% sure. The problem is that it only works when you do this, and probably not later (patch level, schema, index, number of lines, etc.) ...
Work example
This may be unsuccessful because you do not know in what order things are ranked
SELECT foo From MyTable WHERE ISNUMERIC (foo) = 1 AND CAST(foo AS int) > 100
And it can also fail because
SELECT foo FROM (SELECT foo From MyTable WHERE ISNUMERIC (foo) = 1) bar WHERE CAST(foo AS int) > 100
However, this was not the case in SQL Server 2000. The internal query is evaluated and buffered:
SELECT foo FROM (SELECT TOP 100 PERCENT foo From MyTable WHERE ISNUMERIC (foo) = 1 ORDER BY foo) bar WHERE CAST(foo AS int) > 100
Note. It still works in SQL Server 2005
SELECT TOP 2000000000 ... ORDER BY...
gbn Oct 26 '09 at 5:34 2009-10-26 05:34
source share