How does one detect whether a field is blank (not null) and then select another field if it is?
What I really need is a IsBlank function that works the same as IsNull but with with blanks.
REPLACE doesn't work with blanks, COALESCE only works with NULLS.
You can use a
CASE
statement for thisYou could always write an isBlank() function, something like
EDIT: You can't use
IF()
in mssql.Use an IF statement in the SELECT portion of your SQL:
How about combining COALESCE and NULLIF.