Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Bitwise AND operations in a SELECT query

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-11-02 : 11:39:45
Andrew writes "Is it possible to get the AND operator to do a bitwise AND on two values.

Example:
A = 1   (1000)
B = 2 (0100)
C = 15 (1111)
Desired Results:
A AND B = 0 or FALSE
A AND C = 1 or TRUE
B AND C = 2 or TRUE

When I try this:
SELECT * FROM Table WHERE A AND B

I always get TRUE because all the values are true and it's not doing a bit by bit comparison.

Can you help."
   

- Advertisement -