Export (0) Print
Expand All

|| (OR)

Combines two Boolean expressions.

boolean_expression OR boolean_expression
or 
boolean_expression || boolean_expression

boolean_expression
Any valid expression that returns a Boolean.

true when either of the conditions is true; otherwise, false.

OR is an Entity SQL logical operator. It is used to combine two conditions. When more than one logical operator is used in a statement, OR operators are evaluated after AND operators. However, you can change the order of evaluation by using parentheses.

Double vertical bars (||) have the same functionality as the OR operator.

The following table shows possible input values and return types.

 

  TRUE FALSE NULL

TRUE

TRUE

TRUE

TRUE

FALSE

TRUE

FALSE

NULL

NULL

TRUE

NULL

NULL

The following Entity SQL query uses the OR operator to combine two Boolean expressions. 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:


-- OR
SELECT VALUE product FROM AdventureWorksEntities.Products
AS product where product.ListPrice = @price1 OR product.ListPrice = @price2
-- ||
SELECT VALUE product FROM AdventureWorksEntities.Products
AS product where product.ListPrice = @price1 || product.ListPrice = @price2
    




Build Date:

2012-10-01
Show:
© 2014 Microsoft