SQL Flow Field Guide

^ (Bitwise exclusive OR)

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

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.