|
Posted by Techhead on 06/04/07 21:32
On Jun 4, 3:29 pm, "Plamen Ratchev" <Pla...@SQLStudio.com> wrote:
> You can use COALESCE, something like this will do it:
>
> COALESCE(P.ADDR1, '') + ' - ' + COALESCE(P.CITY, '') + ', ' +
> COALESCE(P.STATE, '') AS LOCATION
>
> Also, you can play with formatting variations based on what you want to get
> when one of the columns is NULL, like this:
>
> COALESCE(P.ADDR1, '') + COALESCE(' - ' + P.CITY, '') + COALESCE(', ' +
> P.STATE, '') AS LOCATION
>
> HTH,
>
> Plamen Ratchevhttp://www.SQLStudio.com
Somebody at work told me to use this:
SELECT CASE WHEN P.STATE IS NULL THEN '' ELSE P.STATE END
It seems to work. Is this similar as to what is described above?
Navigation:
[Reply to this message]
|