Events
Mar 31, 11 PM - Apr 2, 11 PM
The ultimate Microsoft Fabric, Power BI, SQL, and AI community-led event. March 31 to April 2, 2025.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
-
(minus sign) unary operatorReturns the negated value of expr
. This function is a synonym for negative function.
- expr
expr
: An expression that evaluates to a numeric or interval.The result type matches the argument type.
For integral numeric types the function can return an ARITHMETIC_OVERFLOW error.
Warning
In Databricks Runtime, if spark.sql.ansi.enabled is false
, an overflow does not cause an error but “wraps” the result instead.
> SELECT -(1);
-1
> SELECT -(cast(-32768 AS smallint));
Error: ARITHMETIC_OVERFLOW
> SELECT -INTERVAL '5' MONTH;
-0-5
Events
Mar 31, 11 PM - Apr 2, 11 PM
The ultimate Microsoft Fabric, Power BI, SQL, and AI community-led event. March 31 to April 2, 2025.
Register today