Skip to main content

BITAND

Description​

Used to perform a bitwise AND operation. The bitwise AND operation compares each bit of two integers. The result is 1 only when both corresponding binary bits are 1, otherwise it is 0.

Integer range: TINYINT, SMALLINT, INT, BIGINT, LARGEINT

Syntax​

BITAND( <lhs>, <rhs>)

Parameters​

parameterdescription
<lhs>The first number involved in the bitwise AND operation
<rhs>The second number to be included in the bitwise AND operation

Return Value​

Returns the result of the AND operation on two integers.

Examples​

select BITAND(3,5), BITAND(4,7);
+---------+---------+
| (3 & 5) | (4 & 7) |
+---------+---------+
| 1 | 4 |
+---------+---------+