MDAC 2.5 SDK - ODBC Programmer's Reference
Appendix D: Data Types
The rules in this section apply for conversions involving numeric literals. For the purposes of these rules, the following terms are defined:
Following are the rules for converting from a character source (CS) to a numeric target (NT):
Following are the rules for converting from a numeric source (NS) to a character target (CT):
Case:
If NS is equal to 0, then YP is 0.
Let YSN be the shortest character string that conforms to the definition of exact-numeric-literal and whose interpreted value is the absolute value of NS. If the length of YSN is less than the (precision + 1) of the data type of NS, then let YP equal YSN.
Otherwise, YP is the shortest character string that conforms to the definition of approximate-numeric-literal whose interpreted value is the absolute value of NS and whose mantissa consists of a single digit that is not '0', followed by a period and an unsigned-integer.
'-' || YP
where '||' is the string concatenation operator.
Otherwise, let Y equal YP.
Otherwise (LY > LT), copy the first LT characters of Y into CT.
Case:
If this is a store assignment, return the error SQLSTATE 22001 (String data, right-truncated).
If this is retrieval assignment, return the warning SQLSTATE 01004 (String data, right-truncated). When the copy results in the loss of fractional digits (other than trailing zeros), it is driver-defined whether one of the following occurs:
(1) The driver truncates the string in Y to an appropriate scale
(which can be zero also) and writes the result into CT.
(2) The driver rounds the string in Y to an appropriate scale
(which can be zero also) and writes the result into CT.
(3) The driver neither truncates nor rounds, but just copies
the first LT characters of Y into CT.