Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to:
Databricks SQL
Databricks Runtime
Returns a bitwise signed right shifted by n bits.
shiftright(expr, n)
expr: AnINTEGERorBIGINTexpression.n: AnINTEGERexpression specifying the number of bits to shift.
The result type matches expr.
When expr is negative (that is, the highest order bit is set) the result remains negative because the highest order bit is sticky.
When n is negative the result is 0.
> SELECT shiftright(4, 1);
2
> SELECT shiftright(-4, 1);
-2