Subject | Re: [firebird-support] Re: String Concatenation with null field |
---|---|
Author | Christian Danner |
Post date | 2006-01-11T08:05Z |
Hi Adam,
on Tue, 10 Jan 2006 00:46:34 -0000, you wrote:
Over-subtle solution for a mostly invisible and thus irrelevant
problem (only for hair splitters):
nullif( substring( coalesce( ' ' || name_t, '') -- Duke
|| coalesce( ' ' || name_f, '') -- Harald
|| coalesce( ' ' || name_p, '') -- van den
|| coalesce( ' ' || name_l, '') -- Leyden
|| coalesce( ' ' || name_s, '') -- II.
from 2), '')
-> 'Duke Harald van den Leyden II.'
- Prevents leading/trailing spaces under all circumstances
- Easy to extend with all fields equally processed
Ciao
Christian
on Tue, 10 Jan 2006 00:46:34 -0000, you wrote:
>Let me guess, someone doesn't have a middle nameBut if LastName isn't set...
>
>select Coalesce(FirstName || ' ', '') || Coalesce(MiddleName
>|| ' ', '') || Coalesce(LastName, '') as FullName
>from employee
Over-subtle solution for a mostly invisible and thus irrelevant
problem (only for hair splitters):
nullif( substring( coalesce( ' ' || name_t, '') -- Duke
|| coalesce( ' ' || name_f, '') -- Harald
|| coalesce( ' ' || name_p, '') -- van den
|| coalesce( ' ' || name_l, '') -- Leyden
|| coalesce( ' ' || name_s, '') -- II.
from 2), '')
-> 'Duke Harald van den Leyden II.'
- Prevents leading/trailing spaces under all circumstances
- Easy to extend with all fields equally processed
Ciao
Christian