-(负号)(Entity SQL)- (Negative) (Entity SQL)

返回数值表达式的值的负值。Returns the negative of the value of a numeric expression.

语法Syntax

- expression  

参数Arguments

expression
任何一种数值数据类型的任何有效表达式。Any valid expression of any one of the numeric data types.

结果类型Result Types

expression 的数据类型。The data type of expression.

备注Remarks

如果 expression 为无符号类型,则结果类型将是与 expression的类型相关性最密切的有符号类型。If expression is an unsigned type, the result type will be the signed type that most closely relates to the type of expression. 例如,如果 expression 属于 Byte 类型,则将返回类型为 Int16 的值。For example, if expression is of type Byte, a value of type Int16 will be returned.

示例Example

以下 Entity SQL 查询使用 - 算数运算符以返回数值表达式的值的负值。The following Entity SQL query uses the - arithmetic operator to return the negative of the value of a numeric expression. 此查询基于 AdventureWorks 销售模型。The query is based on the AdventureWorks Sales Model. 若要编译并运行此查询,请执行下列步骤:To compile and run this query, follow these steps:

  1. 执行 How to: Execute a Query that Returns StructuralType Results中的过程。Follow the procedure in How to: Execute a Query that Returns StructuralType Results.

  2. 将以下查询作为参数传递给 ExecuteStructuralTypeQuery 方法:Pass the following query as an argument to the ExecuteStructuralTypeQuery method:

SELECT VALUE product FROM AdventureWorksEntities.Products 
    AS product WHERE product.ListPrice = -(-@price)

请参阅See also