OR (TSQL Operator)

Performs a logical OR of two boolean expressions.

Syntax

bool_expr OR bool_expr

Arguments

bool_expr
is an expression of type bool.
Such expression can be produced e.g. by comparison operators like =, >, etc.

Return Types

Returns a result of type bool.

Remarks

In SQL, logical operators evaluate to True, False or NULL, with a 3-valued logic.

This table shows the results for the logical OR operator.

True False NULL
True True True True
False True False NULL
NULL True NULL NULL

Examples

PRINT 1=2 OR 2=3;
PRINT 1=1 OR 2=2;
PRINT 1=1 OR 2=3;
PRINT 1=2 OR 2=NULL;

The result is:

false
true
true
<NULL>