Home All Groups Group Topic Archive Search About

Having difficulty with Coalesce

Author
10 Aug 2006 4:51 PM
Matty J
Hi

Simplified version of query:

Have tried both with and without SET CONCAT NULL_YIELDS_NULL ON
But my database default is set to ON anyway.

SELECT Address1 + ' ' + Address2 + COALESCE(', ' + Address3, '') + ', '
+ Town + COALESCE(', ' + County, '') + ', ' + Postcode AS Address From
Table

I'm only new to the COALESCE function, but when say Address3 is NULL,
then nothing from Address 3 onwards is returned into Address.

What am I missing?

Thanks
Matt

Author
10 Aug 2006 5:06 PM
Matty J
Figured it out

It was the Non-COALESCE'd columns that I didn't realise also contained
nulls that was causing the problem.

Cheers
Matt
Author
10 Aug 2006 5:30 PM
Arnie Rowland
Thanks for following up your own post. It prevents others from wasting their
time trying to help you after you have solved the problem, and it helps
others when you share your solution.


--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc

Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous


Show quote
"Matty J" <mattyjen***@gmail.com> wrote in message
news:1155229562.756836.229060@m73g2000cwd.googlegroups.com...
> Figured it out
>
> It was the Non-COALESCE'd columns that I didn't realise also contained
> nulls that was causing the problem.
>
> Cheers
> Matt
>

AddThis Social Bookmark Button