Hi all,
I have a small problem...
I need to do string concatenation in sql server...
i.e.
select field1 + field2 + field3 as JoinedField from table
This works fine IF all the fields have content, but if one of them is null,
then the whole JoinedField is null.
Any idea on how I can fix it? I want the joined value as though the null was
just an empty string.
Thanks.

Signature
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
Just Me - 24 Mar 2008 12:12 GMT
Yeah
IsNull( field1, WhatYouWantGoesHere )
> Hi all,
>
[quoted text clipped - 13 lines]
>
> Thanks.
David - 24 Mar 2008 12:43 GMT
Cool, thank you. That works great...

Signature
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
> Yeah
>
[quoted text clipped - 17 lines]
>>
>> Thanks.
Cowboy (Gregory A. Beamer) - 24 Mar 2008 14:01 GMT
select
CASE WHEN field1 is null then ''
ELSE field1 END
+
CASE WHEN field2 is null then ''
ELSE field2 END
+
CASE WHEN field3 is null then ''
ELSE field3 END AS JoinedField

Signature
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA
Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss
or just read it:
http://gregorybeamer.spaces.live.com/
*************************************************
| Think outside the box!
*************************************************
> Hi all,
>
[quoted text clipped - 13 lines]
>
> Thanks.
Paul Shapiro - 24 Mar 2008 19:24 GMT
And a 3rd version (all 3 would work fine):
Select Coalesce(field1, '') + coalesce(field2, '') etc.
> select
> CASE WHEN field1 is null then ''
[quoted text clipped - 25 lines]
>>
>> Thanks.