^ (Bitwise exclusive OR)
operator ^ (Bitwise exclusive OR)
What changes
- Input
- operand expressions
- Output or change
- computed value
- Return type
- int if the input values are int. smallint if the input values are smallint. tinyint if the input values are tinyint.
Syntax at a glance
expression ^ expression
Work example
A flag field needs ^ (Bitwise exclusive OR) to test or change a specific bit mask.
Use small integer values with one bit set at a time. Compare the mask before and after the expression.
Check your work ^ (Bitwise exclusive OR). The result of ^ (Bitwise exclusive OR) changes only the intended bit and keeps unrelated flags intact.
Open Microsoft Learn for full syntax, permissions, and details for your version.