&is bitwise AND. So if we take
5 & 4, that is
0101 & 0100binary. The result of this is 0100, since it is only in one position there are 1 in both numbers. Then 4 is converted to bit, and when integers are converted to bit, everything that is <> 0 becomes 1.
Sign in to comment
Hi @Alen Cappelletti ,
I am glad to hear that you have accepted the answer.
Hope the following link will be helpful:
& (Bitwise AND) (Transact-SQL)
The & bitwise operator performs a bitwise logical AND between the two expressions, taking each corresponding bit for both expressions. The bits in the result are set to 1 if and only if both bits (for the current bit being resolved) in the input expressions have a value of 1; otherwise, the bit in the result is set to 0.
Please do not hesitate to contact us if you have any new issues.
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.