- (Negative) (Transact-SQL)
SQL Server 2012
Returns the negative of the value of a numeric expression (a unary operator).
A. Setting a variable to a negative value
The following example sets a variable to a negative value.
USE tempdb; GO DECLARE @MyNumber decimal(10,2); SET @MyNumber = -123.45; SELECT @MyNumber; GO
B. Changing a variable to a negative value
The following example changes a variable to a negative value.
USE tempdb; GO DECLARE @Num1 int; SET @Num1 = 5; SELECT -@Num1; GO