By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
create table test ( id int null);
insert into test values ( 1) , (null) ,(3);
3 rows affected
select id, IIF(id is not null, 1 , 0) val from test
id | val |
---|---|
1 | 1 |
null | 0 |
3 | 1 |