I have table “mytable” where value of column “myValue” is null.
I have application where NHibernate calls Sybase Stored procedure.
In procedure,I have Case Statement where I check for null for a value.
Select Case myValue
when null then
0
else
1
End as newValue
from mytable
When I execute this procedure in database tool, I get output as 0.
When I run my application, NHibernate executes this procedure and gives output of 1.
Now, when I change my Case Statement in stored procedure to
Select Case
when myValue is null then
0
else
1
End as newValue
from mytable
Now, When I run my application, Nhibernate executes this procedure and gives output of 0.
It looks like changing SQL in stored procedure does matter to NHibernate.
We figured it out, it was not NHibernate at all..
Our (new-ish) DB Driver didn’t support “case null:”, “@var != null” or “@var = null” we had to use “@var is not null”, “@var is null”, or prepend our sql with ‘SET ANSINULL OFF”