Is a unary operator that returns the negative value of a numeric expression (a unary operator).
- numeric_expression
numeric_expression
Is any valid Microsoft® SQL Server™ expression of any of the data types of the numeric data type category except the datetime or smalldatetime data types.
Returns the data type of numeric_expression, except that an unsigned tinyint expression is promoted to a signed smallint result.
This example sets a variable to a negative value.
DECLARE @MyNumber decimal(10,2)
@MyNumber = -123.45
This example negates a variable.
DECLARE @Num1 int
SET @Num1 = 5
SELECT -@Num1