共用方式為


! (NOT)(Entity SQL)

否定 Boolean 表達式。

語法

NOT boolean_expression  
-- or  
! boolean_expression  

論點

boolean_expression
傳回布爾值的任何有效表達式。

備註

驚嘆號 (!) 的功能與 NOT 運算子相同。

範例

下列 Entity SQL 查詢會使用 NOT 運算符來否定 Boolean 表達式。 查詢是以 AdventureWorks 銷售模型為基礎。 若要編譯並執行此查詢,請遵循下列步驟:

  1. 遵循 如何:執行會傳回 StructuralType 結果的查詢中的程式。

  2. 將下列查詢當做自變數傳遞至 ExecuteStructuralTypeQuery 方法:

-- NOT
SELECT VALUE product FROM AdventureWorksEntities.Products 
AS product WHERE product.ListPrice > @price1 AND NOT (product.ListPrice = @price2)
-- !
SELECT VALUE product FROM AdventureWorksEntities.Products 
AS product WHERE product.ListPrice > @price1 AND ! (product.ListPrice = @price2)

另請參閱