Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Bitwise Operators (Transact-SQL)

 

Applies To: SQL Server 2014, SQL Server 2016 Preview

Bitwise operators perform bit manipulations between two expressions of any of the data types of the integer data type category.

Operator

Meaning

& (Bitwise AND)             

Bitwise AND (two operands).

| (Bitwise OR)             

Bitwise OR (two operands).

^ (Bitwise Exclusive OR)             

Bitwise exclusive OR (two operands).

The operands for bitwise operators can be any one of the data types of the integer or binary string data type categories (except for the image data type), except that both operands cannot be any one of the data types of the binary string data type category. The following table shows the supported operand data types.

Left operand

Right operand

binary             

int, smallint, or tinyint

bit             

int, smallint, tinyint, or bit

int             

int, smallint, tinyint, binary, or varbinary

smallint             

int, smallint, tinyint, binary, or varbinary

tinyint             

int, smallint, tinyint, binary, or varbinary

varbinary             

int, smallint, or tinyint

Community Additions

ADD
Show:
© 2015 Microsoft