I'm trying to concatenate First name, Middle Initial and Last Name. Many
records do not have a middle initial (middle initial is NULL) therefore
causing the concatenation to yield a Null result. Is there an easy trick /
technique to fix this? thanksYou can use COALESCE or ISNULL to replace the NULLs to spaces like:
SELECT first_name + COALESCE( middle_initial, '' ) +
COALESCE( last_name, '' ) AS "full name"
FROM ...
Anith|||Thank You!
"Anith Sen" wrote:
> You can use COALESCE or ISNULL to replace the NULLs to spaces like:
> SELECT first_name + COALESCE( middle_initial, '' ) +
> COALESCE( last_name, '' ) AS "full name"
> FROM ...
> --
> Anith
>
>
Tuesday, March 27, 2012
Concatenate
Labels:
concatenate,
database,
initial,
manyrecords,
microsoft,
mysql,
null,
oracle,
server,
sql
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment