.net - SQLite equivalent to ISNULL(), NVL(), IFNULL() or COALESCE() -
I would like to avoid having too many checks in my code like the following:
MyObj. SomeStringField = rdr.IsDBNull (some ordinal)? String.Empty: rdr.GetString (some ordinal); I think I could take care of the weak in my query by doing something like this:
SELECT myField1, [isnull] (MyField1, ') MyTable1 Where myField1 = someCondition I am using SQLite though and it does not seem to recognize the isnull function I Some similar people recognized in the database ( NVL () , IFNULL () and COALESCE () ) have also tried, but SQLite doesn Any of them recognized He does not think.
Does anyone know any suggestions or better ways to do this? Unfortunately, the database does not have default values for all the fields. In addition, I need to use some LEFT JOIN rules in some cases where some fields will return because the match record will not be available in the LEFT JOIN table.
IFNULL , see here:
No parentheses around the function
Comments
Post a Comment