Subject Re: SV: [firebird-support] Best Practice re null
Author homerjones1941
> >In certain queries I wish nulls to be treated as empty strings.
> >
> >1. Is assigning a default of '' an acceptable practice?
>
> Sure, as long as <unknown> is the same as empty, I cannot think why not.
>
> >2. Is there a better way to handle this, perhaps within the query SQL?
>
> I won't say better, but an alternative would be something like:
>
> Select Field1 || coalesce(' ' || Field2, '') AS MyOutputValue;
>
> I'm assuming you don't want the space after Field1 if Field2 is NULL.


Thank you, Svein. I think I will implement the "Default" solution since my application allows the end user to create ad-hoc queries (of sorts). I think setting the default will produce fewer questions about why records are omitted. You are correct in assuming that <unknown> is the same as empty.

Would there be a problem in using Coalesce(...) in addition to setting the default values? I can't think of any, other than it may be overkill.