frontin frontin - 10 days ago 4x
SQL Question

associate nulls as false on filter

I have a table

that has a column
that is bit but also accepts nulls and it has to be this way. I have a query that brings in a parameter
that is true or false and I need to filter
based on this. I cant do this:

SELECT * FROM tbl WHERE IsLib = @bitIsLib

because I need to treat nulls as false and they will be excluded from this filter. How can I write it so if
is true then it includes true values, and if
is false then it includes false and null values?

SELECT * FROM tbl WHERE ISNULL(IsLib, 0) = @bitIsLib