Anonymous 857
I have a question about this fiddle:
<>https://dbfiddle.uk?rdbms=sqlserver_2019&fiddle=5fb4c089af3d52e645aade8970793767
Is it ever possible to get -1 as the result of this query?
I think no, right because potato can be either null or not null and the case covers both scenario?
sql server 11
Sincerely,
Top Answer
Ami
You are correct.
The CASE conditional expression can evaluate to either 1 or 0, never to a NULL.
The encapsulating ISNULL function will always see a concrete value, `1` or `0`, and so will never return `-1`.
If you explain what you are trying to achieve with this code that doesn't seem to work for you, we may be able to offer some advice.