Bitwise Operators (Database Engine)
Bitwise operators are used on int, smallint, or tinyint data. The ~ (Bitwise NOT) operator can also use bit data. All bitwise operators perform an operation on the one or more specified integer values that are translated to binary expressions within Transact-SQL statements. For example, the ~ (Bitwise NOT) operator changes binary 1s to 0s and 0s to 1s. To see bitwise operations, you can convert or calculate decimal values.
As an example, assume you want to add 150 and 75 together and you are also interested in the decimal value of 225 . However, you also want to use binary arithmetic, the addition of 0s and 1s. Use the bitwise AND operator (&) for this purpose.
If you are storing integer data, ordinary decimal values like the 150 and 75 mentioned earlier, and want to perform internal translation to do binary math, use bitwise operators. Bitwise operators are also very useful in obtaining a NOT value that is not particularly the exact opposite.