I have a table with 2 columns have same name
ValueA ValueB ValueA
12 Yes
No NULL
20 Yes
0 No 0
3 No 3
Logic is that
- when
ValueAis'' - and
ValueBis'No' - then
ValueAin second column should be''(notNULL)
I wrote this case statement but it gives me NULL instead of ''
Case when ValueB ='No' then convert(varchar(25), ValueA)
when ValueB ='No' and ValueA ='' then ''
else ''
end
even if I write
Case when ValueB
when 'No' then convert(varchar(25), ValueA)
else ''
end
both of above code gives me same results
How can I replace or remove NULL with '' in second ValueA column?
I hope i understand the question correct, you can use coalesce or isnull to replace null values.
This could be your case statement: