# Unary Operators - Positive

**APPLIES TO:** SQL Server (starting with 2008) Azure SQL Database Azure SQL Data Warehouse Parallel Data Warehouse

Returns the value of a numeric expression (a unary operator). Unary operators perform an operation on only one expression of any one of the data types of the numeric data type category.

Operator | Meaning |
---|---|

+ (Positive) | Numeric value is positive. |

- (Negative) | Numeric value is negative. |

~ (Bitwise NOT) | Returns the ones complement of the number. |

The + (Positive) and - (Negative) operators can be used on any expression of any one of the data types of the numeric data type category. The ~ (Bitwise NOT) operator can be used only on expressions of any one of the data types of the integer data type category.

Transact-SQL Syntax Conventions

## Syntax

```
+ numeric_expression
```

## Arguments

*numeric_expression*

Is any valid expression of any one of the data types in the numeric data type category, except the **datetime** and **smalldatetime** data types.

## Result Types

Returns the data type of *numeric_expression*.

## Remarks

Although a unary plus can appear before any numeric expression, it performs no operation on the value returned from the expression. Specifically, it will not return the positive value of a negative expression. To return positive value of a negative expression, use the ABS function.

## Examples

### A. Setting a variable to a positive value

The following example sets a variable to a positive value.

```
DECLARE @MyNumber decimal(10,2);
SET @MyNumber = +123.45;
SELECT @MyNumber;
GO
```

Here is the result set:

```
-----------
123.45
(1 row(s) affected)
```

### B. Using the unary plus operator with a negative value

The following example shows using the unary plus with a negative expression and the ABS() function on the same negative expression. The unary plus does not affect the expression, but the ABS function returns the positive value of the expression.

```
USE tempdb;
GO
DECLARE @Num1 int;
SET @Num1 = -5;
SELECT +@Num1, ABS(@Num1);
GO
```

Here is the result set:

```
----------- -----------
-5 5
(1 row(s) affected)
```

## See Also

Data Types (Transact-SQL)

Expressions (Transact-SQL)

Operators (Transact-SQL)

ABS (Transact-SQL)