Compare the string, int and nText data type with a string data type in CASE WHEN TSQL
In this case, Column1 is a string,
select case when column1 = 'sometext' then 1 else 0 end
from table1
In this case, Column1 is an integer,
select case when cast(column1 as varchar(max)) = 'sometext' then 1 else 0 end
from table1
In this case, Column1 is a nText,
select case when cast(column1 as nvarchar(max)) = N'sometext' then 1 else 0 end
from table1
In this case, Column1 is a string,
select case when column1 = 'sometext' then 1 else 0 end
from table1
In this case, Column1 is an integer,
select case when cast(column1 as varchar(max)) = 'sometext' then 1 else 0 end
from table1
In this case, Column1 is a nText,
select case when cast(column1 as nvarchar(max)) = N'sometext' then 1 else 0 end
from table1