-
Erland Sommarskog 68,106 Reputation points Microsoft MVP
2021-04-03T22:09:37.423+00:00 &
is bitwise AND. So if we take5 & 4
, that is0101 & 0100
binary. 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.
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.
Best regards
Mona
----------
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.