- (Unary Minus) (TSQL Operator)
Returns the negative value of a number.
Syntax
- expression
Arguments
- expression
- is a numeric expression of type
tinyint,smallint,int,bigint,money,numeric,float.
Return Types
Returns the same datatype as expression.
Remarks
If expression is tinyint, result type is promoted to smallint.
For integer types, if expression is the minimum value for this type, an overflow error is raised.
Examples
PRINT -10;
PRINT 123.45 * -30;
The result is:
-10
-3703.50
Example of overflow
DECLARE @a INT = -2147483648;
PRINT -@a;
The result is:
<Arithmetic error. INT overflow.>