! (NOT) (Entity SQL)

執行 Boolean 運算式的否定運算。

NOT boolean_expression
or
!  boolean_expression  

Arguments

  • boolean_expression
    傳回布林值的任何有效運算式。

備註

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

範例

下列 Entity SQL 查詢會使用 NOT 運算子執行 Boolean 運算式的否定運算。 此查詢是根據 AdventureWorks Sales Model。 若要編譯及執行此查詢,請遵循以下步驟:

  1. 按照 HOW TO:執行可傳回 StructuralType 結果的查詢 (EntityClient) 中的程序進行。

  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)

另請參閱

概念

Entity SQL 參考