-(음수)(SQL Server Compact Edition)

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

구문

- numeric_expression

인수

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

결과 형식

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

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

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

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

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

참고 항목

도움말 및 정보

SQL Server Compact Edition 지원 정보 보기