In my SQL server query I want to always get 0 results. I only want to get the metadata.
How to write an always false evaluation in TSql? Is there a built-in function, or a recommended way of doing so?
Currently I use WHERE 1 = 0, but I'm looking for something like WHERE 'false'.
Although you can use where 1 = 0 for this purpose, I think top 0 is more common:
select top 0 . . .
. . .
This also prevents an "accident" in the where clause. If you change this:
where condition x or condition y
to:
where 1 = 0 and condition x or condition y
The parentheses are wrong.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With