共用方式為


<> (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 != (Not Equal To) (Entity SQL) operator.

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 <> comparison 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 (EntityClient).

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

SELECT VALUE product FROM AdventureWorksEntities.Product 
    AS product where product.ListPrice <> 0

The output is shown below:

ProductID: 514
Name: LL Mountain Seat Assembly
ProductNumber: SA-M198
MakeFlag: True
ProductID: 515
Name: ML Mountain Seat Assembly
ProductNumber: SA-M237
MakeFlag: True
ProductID: 516
Name: HL Mountain Seat Assembly
ProductNumber: SA-M687
MakeFlag: True
ProductID: 517
Name: LL Road Seat Assembly
ProductNumber: SA-R127
MakeFlag: True
ProductID: 518
Name: ML Road Seat Assembly
ProductNumber: SA-R430
MakeFlag: True
...

See Also

Concepts

Entity SQL Reference

Other Resources

Comparison Operators