Google-fu is failing me on this one. Can anyone briefly explain what the following statement would do?:
UPDATE
message WITH (ROWLOCK)
SET
message = message | 2
I found this in a trigger, and I am unable to find docs explaining what the | character does in a statement like this.
That is a bitwise OR
http://msdn.microsoft.com/en-us/library/ms176122.aspx
It's the bitwise OR operator. See this article. Effectively, message
is a bitfield, and by bitwise-ORing it with 2, you're setting the second bit. See Wikipedia's bitwise operation article for a good overview of bit-twiddling :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With