Share via


= (Equals) (Transact-SQL)

Compares the equality of two expressions (a comparison operator).

Topic link iconTransact-SQL Syntax Conventions

Syntax

expression = expression

Arguments

  • expression
    Is any valid expression. If the expressions are not of the same data type, the data type for one expression must be implicitly convertible to the data type of the other. The conversion is based on the rules of data type precedence.

Remarks

When you compare two NULL expressions, the result depends on the ANSI_NULLS setting:

  • If ANSI_NULLS is set to ON, the result is NULL, following the ANSI convention that a NULL (or unknown) value is not equal to another NULL or unknown value.
  • If ANSI_NULLS is set to OFF, the result of NULL compared to NULL is TRUE.

Comparing NULL to a non-NULL value always results in FALSE.

Result Types

Boolean

See Also

Reference

Data Types (Transact-SQL)
Expressions (Transact-SQL)
Operators (Transact-SQL)

Other Resources

Comparison Operators (Database Engine)

Help and Information

Getting SQL Server 2005 Assistance