Originally posted by Jim
ORDER BY clause in your SQL so the TOP 5 predicate is equivalent to ANY 5. How the SQL engine processes your SQL depends on what you specify primarily, but outside of that it makes its best guess as to which approach will be most efficient. In a UNION query that guess may result in a completely different approach and therefore different records selected.That said, I can only see this data coming out if the records selected all have empty string values. Not sure how likely that is in your data.
Nevertheless, I would always suggest an
ORDER BY clause be used when using the TOP predicate unless you really don't care what the results are.
Comment