I just tested a variation, where I moved the ORDER BY clause up into the SELECT INTO query, and it continues to produce a correct result, but apparently, only because SQL Server is forced to instantiate the data via the temp table. Otherwise, it appears the optimizer shortcuts the process. Take a look at the execution plans, as I don't have the ability to do that in my current environment.
Steve
(aka smunson)
:):):)
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)