Cast Method


This is an overview of what will happen when a column is cast from one data type to another.

Input

Output

 

Integer

Real

Decimal

Date/DateTime/Time

String

Binary

Integer

Same value.

 Value cast to real.

Value converted to decimal if it fits in the limit. Null otherwise.

Date* value is created using the integer value as ticks.

Formatted using input formatter.

Null.

Real

Integer part of real value is it fits in the limit. Null otherwise.

 Same value.

Value converted to decimal if it fits in the limit. Null otherwise.

Date* value is created using the integer part of the value as ticks.

Formatted using input formatter.

Null.

Decimal

Integer part of decimal value is it fits in the limit. Null otherwise.

Decimal value rounded to Real if it fits, null otherwise.

Same value.

Date* value is created using the integer part of the value as ticks.

Formatted using input formatter.

Null.

Date/DateTime/Time

Number of ticks if it fits in the limit. Null otherwise.

Number of ticks converted to real.

Number of ticks converted decimal if it fins in the limit. Null otherwise.

Same value.

Formatted using input formatter.

Null.

String

Try to parse using output formatter. Null if it failed to parse.

Try to parse using output formatter. Null if it failed to parse.

Try to parse using output formatter. Null if it failed to parse.

Try to parse using output formatter. Null if it failed to parse.

Same value.

Null.

Binary

Null.

Null.

 Null.

Null.

Null.

Same value.

* Date, DateTime or Time.

See also:

Conversion Functions