Q: Tsql translation Supose I have a table like
Id | IsActive
1  | True
2  | False

And i want to search items that are active, not active or both
I would like to have a query
declare @ActiveState bit
Select * from myTable where IsActive...
and on my where clause i would like to have something like
if(@ActiveState != null)
    myTable.IsActive == @ActiveState
else
    myTable.ActiveState == true || myTable.ActiveState == false

but i can't find a way to do this on the same where clause
tks

A: select * from myTable where @ActiveState is null or IsActive = @ActiveState


A: WHERE myTable.IsActive  = @ActiveState OR @ActiveState IS NULL


A: Where IsActive  = IsNull(@ActiveState, IsActive)
or
Where IsActive  = Coalesce(@ActiveState, IsActive)
