Hi all you experts I am trying to convert a number to a true/false statement. True if the bit is on.
Below is my data:
Ident Device Shelf Row count bit
15 TubeStore0113 10 2 7
I want to convert 7 into position 1,2,3 are on and position 4 is off based on the bit value.
Below I & the bit with the column 1-4 and got a return of 1,2,4,8 which is correct, but I guess I am having trouble changing that value to true/false.
So how would I add an If statement around each column and retrun true if the value > 0
SELECT TOP (1) Ident, DeviceName, Shelf, Row, CoumnCount, CountBit, TubeCount, CountBit & 1 AS Column1, CountBit & 2 AS Column2,
CountBit & 4 AS Column3, CountBit & 8 AS Column4
WHERE (DeviceName = N'TubeStore0113') AND (CoumnCount = 3)
ORDER BY Ident