!= (不等於) (Entity SQL)
比較兩個運算式來判斷左運算式是否不等於右運算式。 != (不等於) 運算子的功能就相當於 <> 運算子。
expression != expression
or
expression <> expression
Arguments
- expression
任何有效的運算式。 兩個運算式都必須有可隱含轉換的資料型別。
結果型別
如果左運算式不等於右運算式,則為 true,否則為 false。
範例
下列 Entity SQL 查詢使用 != 運算子來比較兩個運算式,以判斷左運算式是否不等於右運算式。 此查詢是以 AdventureWorks Sales Model 為依據。 若要編譯及執行此查詢,請遵循以下步驟:
將下列查詢當成引數傳遞至
ExecuteStructuralTypeQuery
方法:
-- !=
SELECT VALUE product FROM AdventureWorksEntities.Products
AS product where product.ListPrice != @price
-- <>
SELECT VALUE product FROM AdventureWorksEntities.Products
AS product where product.ListPrice <> @price