Muokkaa

Jaa


!= (Not Equal To) (Entity SQL)

Compares two expressions to determine whether the left expression is not equal to the right expression. The != (Not Equal To) operator is functionally equivalent to the <> operator.

Syntax

expression != expression  
-- or  
expression <> expression  

Arguments

expression
Any valid expression. Both expressions must have implicitly convertible data types.

Result Types

true if the left expression is not equal to the right expression; otherwise, false.

Example

The following Entity SQL query uses the != operator to compare two expressions to determine whether the left expression is not equal to the right expression. The query is based on the AdventureWorks Sales Model. To compile and run this query, follow these steps:

  1. Follow the procedure in How to: Execute a Query that Returns StructuralType Results.

  2. Pass the following query as an argument to the ExecuteStructuralTypeQuery method:

-- !=
SELECT VALUE product FROM AdventureWorksEntities.Products 
    AS product WHERE product.ListPrice != @price
-- <>
SELECT VALUE product FROM AdventureWorksEntities.Products 
    AS product WHERE product.ListPrice <> @price

See also