patriotpacer
asked on
CASE WHEN is null - SQL Server
select
case col when null then 'No' else 'Yes' end
from table
The yes comes through but the No part comes back as null.
How to fix? Using SQL Server I've tried numerous variations with no success.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Does the column show 'NULL' when listed? or the filed contains ''? Can you please list some rows from the table, listing few of both?
ASKER
My apologies. Won't be able to test until Monday.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I appreciate all the help. I did try every solution but all gave me the same result - which the Yes values come through but No values always came null.
I did a workaround with an "isnull" wrapped around me case statement to get it to work.
Given the pattern and knowledge posted here, I'm assuming this is still an issue on my side.
But I do believe the solutions posted will work in most cases, so I'm going to close out this question.
I really appreciate all the help.
I did a workaround with an "isnull" wrapped around me case statement to get it to work.
Given the pattern and knowledge posted here, I'm assuming this is still an issue on my side.
But I do believe the solutions posted will work in most cases, so I'm going to close out this question.
I really appreciate all the help.
ASKER