In this instance I am using SQL Server 2000 which doesn't have DECODE. I figured it out though, have to use the CASE Function like such:
Select (CASE WHEN Field1 IS NULL THEN '' ELSE Field1) +
(CASE WHEN Field2 IS NULL THEN '' ELSE Field2 END) As bothfields
From Table
Thanks for the lead.
Am I posting this on the write Forum? Is this only for Oracle/PSQL?
Travis
Quote:
Originally posted by alligatorsql.com
Hello Travis,
every operation with NULL comes to NULL
a + NULL = NULL
a || NULL = NULL and so on and so on
What you are seeking for is DECODE.
Try your statement with the following commands
Select Field1 || DECODE(Field2, NULL, '', Field2) AS tablefields from table
I hope that you are using Oracle otherwise found the counterpart to DECODE ...
Hope this helps ?
Regards
Manfred Peter
(Alligator Company)
http://www.alligatorsql.com
|