Decimal Digits
For the SQL_DECIMAL and SQL_NUMERIC data types, the maximum scale is generally
the same as the maximum precision. However, some data sources impose a
separate limit on the maximum scale. To determine the minimum and maximum scales
allowed for a data type, an application calls SQLGetTypeInfo.
The decimal digits defined for each concise SQL data type is shown in the
following table.
SQL type
| Decimal digits
|
All character and binary types [a] | n/a
|
SQL_DECIMAL SQL_NUMERIC | The defined number of digits to the right of the decimal point. For example,
the scale of a column defined as NUMERIC(10,3) is 3. This can be a negative
number to support storage of very large numbers without using exponential notation;
for example, “12000” could be stored as “12” with a scale of ––3.
|
All exact numeric types other than SQL_DECIMAL and SQL_NUMERIC [a] | 0
|
All approximate data types [a] | n/a
|
SQL_TYPE_DATE, and all interval types with no seconds component [a] | n/a
|
All datetime types except SQL_TYPE_DATE, and all interval types with a seconds component | The number of digits to the right of the decimal point in the seconds part of
the value (fractional seconds). This number cannot be negative.
|
[a] The DecimalDigits argument of SQLBindParameter is ignored for this data type. |
|
SQL type
| Descriptor field corresponding to decimal digits
|
All character and binary types | n/a
|
All exact numeric types | SCALE
|
SQL_BIT | n/a
|
All approximate numeric types | n/a
|
All datetime types | PRECISION
|
All interval types with a seconds component | PRECISION
|
All interval types with no seconds component | n/a
|