June 8, 2008 at 6:32 pm
I have a CASE WHEN in with my SELECT statement and I can not get it to return the desired value when ever a column is NULL.
Basically if the column is NULL I want to return N/A instead of NULL.
Here is a pic to help:
Thanks again !
Erik
Dam again!
June 8, 2008 at 6:55 pm
Hey,
There is an ISNULL function that you may consider using.
Select isnull(p.NAME, 'N/A') would do the same thing as the case statement.
Not sure it will solve your Null problem though...
~PD
June 8, 2008 at 8:15 pm
That works perfect !
Thanks
Dam again!
June 9, 2008 at 1:01 am
...or in the case statement
CASE WHEN p.Name is null then 'N/A' ELSE p.Name END
(but isnull is better here.)
The issue is that nothing is equal to null i.e. p.Name = null returns false.
June 9, 2008 at 11:48 am
You can also use COALESCE(ColumnName, 'N/A')
Todd Fifield
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply