Share via


== (Equal) (SSIS)

Performs a comparison to determine if two expressions are equal. The expression evaluator automatically converts many data types before it performs the comparison. For more information, see Data Type Conversion in Expressions.

However, some data types require that the expression include an explicit cast before the expression can be evaluated successfully. For more information about legal casts between data types, see Cast (SSIS).

Syntax


expression1 == expression2
        

Arguments

  • expression1, expression2
    Is any valid expression.

Result Types

DT_BOOL

Remarks

The expression set, expression1 and expression2, must follow one of these rules:

  • Numeric. Both expression1 and expression2 must be a numeric data type. The intersection of the data types must be a numeric data type, as specified in the rules about the implicit numeric conversions that the expression evaluator performs. The intersection of the two numeric data types cannot be null. For more information, see Data Type Conversion in Expressions.
  • Character. Both expression1 and expression2 must evaluate to either a DT_STR or a DT_WSTR data type. The two expressions can evaluate to different string data types.
  • Date. Both expression1 and expression2 must evaluate to one of the date data types: DT_DBDATE, DT_DATE, DT_DBTIME, DT_DBTIMESTAMP, or DT_FILETIME. The two expressions can evaluate to different date data types. Dates are converted to the DT_DBTIMESTAMP data type before they are compared.
  • Logical. Both expression1 and expression2 must evaluate to a Boolean.
  • GUID. Both expression1 and expression2 must evaluate to the DT_GUID data type.
  • Binary. Both expression1 and expression2 must evaluate to the DT_BYTES data type.
  • BLOB. Both expression1 and expression2 must evaluate to the same Binary Large Object Block (BLOB) data type: DT_TEXT, DT_NTEXT, or DT_IMAGE.

String comparisons are case, accent, kana, and width-sensitive.

If either expression in the comparison is null, the comparison result is null. If both expressions are null, the result is null.

Examples

This example evaluates to TRUE if the current date is July 4, 2003. For more information, see GETDATE (SSIS).

"7/4/2003" == GETDATE()

This example evaluates to TRUE if the value in the ListPrice column is 500.

ListPrice == 500

This example uses the variable LPrice. It evaluates to TRUE if the value of LPrice is 500. The data type of the variable must be numeric for the expression to parse successfully.

@LPrice == 500

See Also

Reference

!= (Unequal) (SSIS)

Concepts

Operator Precedence and Associativity

Other Resources

Operators (SSIS)

Help and Information

Getting SQL Server 2005 Assistance