Click to Rate and Give Feedback
MSDN
MSDN Library
SQL Server
SQL Server 2008
Technical Reference
 Implicit Data Type Conversion in Ex...
Other versions are also available for the following:
SQL Server 2008 Books Online (May 2008)
Implicit Data Type Conversion in Expressions
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

An implicit conversion of a data type occurs when the expression evaluator automatically converts the data from one data type to another. For example, if a smallint is compared to an int, the smallint is implicitly converted to int before the comparison is performed.

The expression evaluator cannot perform implicit data conversion when the arguments and operands have incompatible data types. In addition, the expression evaluator cannot implicitly convert any value to a Boolean. Instead, the arguments and operands must be explicitly converted by using the cast operator. For more information, see Cast (SSIS).

The following diagram shows the result type of implicit conversions of BINARY operations. The intersection of column and row in this table is the result type of a binary operation with operands of the left (From) and right (To) types.

Implicit data type conversion between data types

The intersection of a signed and an unsigned integer is a signed integer that is potentially larger than either argument.

Operators compare strings, dates, Booleans, and other data types. Before an operator compares two values, the expression evaluator performs certain implicit conversions. For more information, see the following topics:

A function that uses a single argument returns a result with the same data type as the argument, with the following exceptions:

  • DAY, MONTH, and YEAR accept a date and return an integer (DT_I4) result.
  • ISNULL accepts an expression of any SSIS data type and returns a Boolean (DT_BOOL) result.
  • SQUARE and SQRT accept a numeric expression and return a non-integral numeric (DT_R8) result.

If the arguments have the same data type, the result is of that type. The only exception is the result of a binary operation on two values with the DT_DECIMAL data type, which returns a result with the DT_NUMERIC data type.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker