Bitwise OR (|) : bitwise operators « Data Types « SQL Server / T-SQL Tutorial






Bitwise OR (|) Truth Table
|      0      1
0      0     1
1      1     1

Combining Multiple Flags Using the Bitwise OR Operator, Behind the Scenes
 00000001 -- 1
|
  00000010 -- 2
|
  00000100 -- 4
|
  00001000 -- 8
  --------
  00001111 -- 1+2+4+8 = 15
Combining Multiple Flags Using the Bitwise OR Operator, in T-SQL
19> SELECT
20>   1 | 2 | 4 | 8
21> GO

-----------
         15

(1 rows affected)








5.3.bitwise operators
5.3.1.Selecting data using bitwise operators.
5.3.2.Testing numeric values with bitwise operators.
5.3.3.Bitwise NOT (~) Validity Table
5.3.4.Legal Bitwise Operation
5.3.5.Retrieving Index Properties by Using the Bitwise AND (&) Operator
5.3.6.Bitwise AND (&)
5.3.7.Bitwise OR (|)
5.3.8.Exclusive Or (^)
5.3.9.Bitwise NOT (~)
5.3.10.The bitwise_not() Scalar Function
5.3.11.The bitwise_and() Scalar Function
5.3.12.The bitwise_or() Scalar Function
5.3.13.The bitwise_xor() Scalar Function