SQL Flow Field Guide

|= (Bitwise OR assignment)

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

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

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