Came across this question
SQL Server: Select Top 0?
I want to ask if I use query
SELECT * FROM table WHERE 0=1
SELECT TOP 0 * FROM table
The SQL Server query optimizer is smart enough to figure out that this
WHERE condition can never ever produce a
true result on any row, so it doesn't bother actually scanning the table.
If you look at the actual execution plan for such a query, it's easy to see that nothing is being done and the query returns immediately: