<> (Not Equal To) (TSQL Operator)

Returns the result of <> comparison of two expressions.

Syntax

expression <> expression

expression != expression

Arguments

expression
is an expression of any type.

Return Types

Returns a bool value.

Remarks

The operators <> and != are exactly the same.

If expressions are varchar, the comparison is affected by the collation.

If any expression is NULL, result is NULL.

Examples

PRINT NULL <> NULL;
PRINT 1234 <> NULL;
PRINT 1234 <> 78;
PRINT 1234 <> 1234;
PRINT 1234 <> 3000;

The result is:

<NULL>
<NULL>
true
false
true