Detecting if bit set in numeric value
From your previous questions you use SQL Server. So you can use the &amp; operator.

e.g. to see if the bit for 4 is on (and assuming NULL should return NULL)

SELECT CASE number &amp; 4 WHEN 4 THEN 1 WHEN 0 THEN 0 END