SQL Flow Field Guide

^= (Bitwise exclusive OR assignment)

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

compound assignment ^= (Bitwise exclusive OR assignment)

What changes

Input
target value and an expression
Output or change
the same variable or column
Return type
Returns the data type of the argument with the higher precedence. For more information, see Data type precedence.

Syntax at a glance

expression ^= expression

Work example

A flag field needs ^= (Bitwise exclusive OR assignment) 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 assignment). The result of ^= (Bitwise exclusive OR assignment) changes only the intended bit and keeps unrelated flags intact.

Open Microsoft Learn for full syntax, permissions, and details for your version.