-(음수)(SQL Server Compact)

숫자 식의 음수 값을 반환하는 단항 연산자

구문

- numeric_expression

인수

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

결과 형식

부호 없는 tinyint 식이 부호 있는 smallint 결과로 확장되는 경우를 제외하고 numeric_expression의 데이터 형식을 반환합니다.

다음 예에서는 양수 및 음수 단항 연산자의 작동 방식을 보여 줍니다. 음수 값에 대해 양수 단항 연산자를 설정한 경우 반환 값은 음수(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'
-- With the negative unary operator, the value returned is '12'.

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'.