Bitwise Operators

XYX&YX|YX^Y~X
000001
010111
100110
111100

See the following topics:

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 operandRight operand
binaryintsmallint, or tinyint
bitintsmallinttinyint, or bit
bigintbigintintsmallinttinyintbinary, or varbinary
intintsmallinttinyintbinary, or varbinary
smallintintsmallinttinyintbinary, or varbinary
tinyintintsmallinttinyintbinary, or varbinary
varbinaryintsmallint, or tinyint

Sources:

https://docs.microsoft.com/en-us/sql/t-sql/language-elements/bitwise-operators-transact-sql?view=sql-server-ver15

Last modified: November 8, 2019

Author

Comments

Write a Reply or Comment