declare @t table(row int, isalive bit) insert @t values ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Bicycles Meta

Q&A about the site for people who build and repair bicycles, people who train cycling, or commute on bicycles

declare @t table(row int, isalive bit)

insert @t values (1,1)
insert @t values (2,0)
insert @t values (3,null)

declare @isalive bit
set @isalive = 0

SELECT * FROM @t
where coalesce((1-coalesce(isalive, 0)) ^  @isalive , 1) = 1

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results