C# – isNull(col, ”)

ccaseisnullsubsonic

How to write queries to do the followings in SubSonic/C#?

select isNull(col, someDefaultValue) from table

select x =
case
when (condition) then col1
else col2
end
from table

Best Answer

I don't have SubSonic up and running locally, but it looks like it supports the coalesce function, which is what your first query seems to be doing. (Coalesce takes any number of parameters and returns the first non-null one.)