SQL checks if the value of a column is null in a where statement and, if so, set it to a certain value


I have this SQL query

FROM   ##tempt
WHERE  ( minstock <= 0
         AND numitems - backorder - cstock >= 1 )
        OR ( minstock >= 1
             AND numitems - backorder + minstock - cstock >= 1 )

How would I check if the value of minstock is null and if its null then set it to some number?

you can use isnull(minstock, 0) - it will return 0 if minstok is null. you can also use coalesce(minstock, other_field, 0) for more than two values