RIGHT_SHIFT
bit-level operation
What changes
- Input
- integer or binary arguments
- Output or change
- computed value
- Return type
- Returns the same type as expression_value. The shift_amount parameter is cast to a bigint. The parameter can be positive or negative, and can also be greater than the number of bits in the data type o
Syntax at a glance
RIGHT_SHIFT ( expression_value , shift_amount ) expression_value >> shift_amount
Work example
Move a value right to inspect or decode a packed bit field.
Try zero, the lowest bit, the highest bit, and a negative value of the same SQL type.
Check your work Check signed or unsigned interpretation before reading the shifted result.
Open Microsoft Learn for full syntax, permissions, and details for your version.