|
The bitwise AND operator performs a bitwise logical AND operation between two operands.
The bitwise AND compares two bits and assigns a value equal to 1 to the result only if the values of both the bits are equal to 1. Otherwise, the bit in the result is set to 0. The AND operator, like all other bitwise operators, takes only numeric values as its operands.
Expression is any valid expression containing the integer data type, which is transformed into a binary number for the bitwise operation.
In a bitwise AND operation involving operands of different integer data types, the argument of the smaller data type is converted to the larger data type or to the data type that is immediately larger than the larger of the two operands. For example, when performing an AND operation involving smallint and integer, the smallint expression is converted to integer.
If any of the operands involved in a bitwise AND operation is signed, then the resultant value is also signed.
The & operator can be used in conjunction with the IF function to find out whether a table is a system table or a user-defined table.
When this statement is run against the Demodata sample database, the following results are returned:
|
Chapter contents
Prev topic: Overview
|