I am working with one query in MSSQL like this:
select company_id,isshowable from company where company_id in (1,2);
It will give results like:
company_id | isshowable
1 | NULL
2 | true
Here, company_id 1 has isshowable = NULL value. When I apply the isnull
function with this query:
select isshowable, company_id
from company
where company_id in (1,2)
and (isshowable='true' OR isshowable = ISNULL(isshowable,'true'));
It gives only one record which has company_id = 2. Why is the ISNULL function is not replacing NULL value with 'true'?
My requirement is that both records should be fetched from the database, and NULL values should be replaced with 'true'.
What should be a proper way to achive this ?