& (Bitwise AND) (SQL Server Compact)
SQL Server 2008
Performs a bitwise logical AND operation between two integer values.
The following example performs the bitwise AND operation between two integer columns.
CREATE TABLE bitwise (A int NOT NULL, B int NOT NULL) INSERT bitwise VALUES (170, 75) SELECT A & B FROM bitwise --Returns 10.
The binary representation of 170 (A) is 0000 0000 1010 1010. The binary representation of 75 (B) is 0000 0000 0100 1011. Performing the bitwise AND operation on these two values produces the binary result 0000 0000 0000 1010, which is decimal 10.
(A & B)
0000 0000 1010 1010
0000 0000 0100 1011
-------------------
0000 0000 0000 1010