MDAC 2.5 SDK - ODBC Programmer's Reference
Appendix D: Data Types


 

Rules for Conversions

The rules in this section apply for conversions involving numeric literals. For the purposes of these rules, the following terms are defined:

Character Source to Numeric Target

Following are the rules for converting from a character source (CS) to a numeric target (NT):

  1. Replace CS with the value obtained by removing any leading or trailing spaces in CS. If CS is not a valid numeric-literal, SQLSTATE 22018 (Invalid character value for cast specification) is returned.

  2. Replace CS with the value obtained by removing leading zeroes before the decimal point, trailing zeroes after the decimal point, or both.

  3. Convert CS to NT. If the conversion results in a loss of significant digits, SQLSTATE 22003 (Numeric value out of range) is returned. If the conversion results in the loss of nonsignificant digits, SQLSTATE 01S07 (Fractional truncation) is returned.

Numeric Source to Character Target

Following are the rules for converting from a numeric source (NS) to a character target (CT):

  1. Let LT be the length in characters of CT. For retrieval assignment, LT is equal to the length of the buffer in characters minus the number of bytes in the null-termination character for this character set.

  2. Cases:
  3. Case:
  4. Let LY be the length in characters of Y.

  5. Case: