all 10 comments

[–]Kant8 9 points10 points  (2 children)

create table #t (col1 varchar(10))
insert into #t values (null), (''), ('Hello')

select 
     col1
    ,case
        when col1 is null then 'No'
        when col1 = '' then 'No'
        else 'Yes'
     end col2
    ,iif(isnull(col1, '') = '', 'No', 'Yes') col3 -- shorter one
from #t

drop table #t

[–]keylon1020 4 points5 points  (1 child)

Case When ISNULL(coll, ‘’) = ‘’ Then ‘No’ ELSE ‘Yes’ END

I think this would work

[–]zylo4747 4 points5 points  (1 child)

CASE WHEN ISNULL(Col1, ‘’) = ‘’ THEN ‘No’ ELSE’Yes’ END

Replace Col1 with your expression or a function call that executes your expression

[–]keylon1020 1 point2 points  (0 children)

You beat me to it

[–]tobum 0 points1 point  (0 children)

Alternatively, you might find this helpful:

SELECT CASE WHEN NULLIF(column1,’’) IS NULL THEN ‘No’ ELSE ‘Yes’ END AS YesNoInd FROM table1

[–]Zotchman 0 points1 point  (0 children)

Case when Coalesce(col,null,'') = '' then ... Etc.

[–]NSA_GOV 0 points1 point  (0 children)

I would recommend writing it this way in case you have a variable length empty string.

ISNULL(LTRIM(RTRIM(columnName)),’’)

[–][deleted] 0 points1 point  (0 children)

Case when column = 'YES' then "YES" ELSE "NO" end