I\'d like to avoid having many checks like the following in my code:
myObj.someStringField = rdr.IsDBNull(someOrdinal)
? string.
Try this
ifnull(X,Y)
e.g
select ifnull(InfoDetail,'') InfoDetail; -- this will replace null with ''
select ifnull(NULL,'THIS IS NULL');-- More clearly....
The ifnull() function returns a copy of its first non-NULL argument, or NULL if both arguments are NULL. Ifnull() must have exactly 2 arguments. The ifnull() function is equivalent to coalesce() with two arguments.