NOT (TSQL Operator)
Performs a logical NOT of a boolean expression.
Syntax
NOT 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 NOT operator.
| NOT | |
|---|---|
| True | False |
| False | True |
| NULL | NULL |
Examples
PRINT NOT 1=1;
PRINT NOT 1=2;
PRINT NOT 1=NULL;
The result is:
false
true
<NULL>