& (Bitwise AND) (TSQL Operator)

Returns the bitwise AND value of two integers.

Syntax

expression & expression

Arguments

expression
is a numeric expression of type bit, tinyint, smallint, int, bigint.

Return Types

Returns the datatype of the expression with the highest type precedence.

Examples

-- binary representation of 143 is        10001111
-- binary representation of  95 is        01011111
-- binary representation of 143 & 95 is   00001111 (15)

PRINT 143 & 95;

The result is:

15