+(양수)(SQL Server Compact)

숫자 식의 양수 값을 반환하는 단항 연산자입니다.

구문

+ numeric_expression

인수

  • numeric_expression
    SQL Server Compact 4.0에서 datetime 데이터 형식을 제외한 숫자 데이터 형식 범주에 속하는 모든 데이터 형식의 유효한 식입니다.

결과 형식

numeric_expression의 데이터 형식을 반환합니다. 단, 부호 없는 tinyint 식은 smallint 결과로 확장됩니다.

다음 예에서는 Orders 테이블을 사용하여 양수 및 음수 단항 연산자의 작동 방식을 보여 줍니다. 음수 값에 대해 양수 단항 연산자를 설정한 경우 반환 값은 음수(positive_value * negative_value = negative_value)입니다. 음수 값에 대해 음수 단항 연산자를 설정한 경우 반환 값은 양수(negative_value * negative_value = positive_value)입니다.

SELECT (DATEPART(day, Order Date) - DATEPART(day, Shipped Date)) 
FROM Orders 
WHERE OrderID = '10248'
-- Without a unary operator, the value returned is '-12'.

SELECT +(DATEPART(day, Order Date) - DATEPART(day, Shipped Date)) 
FROM Orders 
WHERE OrderID = '10248'
-- With the positive unary operator, the value returned is '-12'.

SELECT -(DATEPART(day, Order Date) - DATEPART(day, Shipped Date)) 
FROM Orders 
WHERE OrderID = '10248'
-- With the negative unary operator, the value returned is '12'.