Condividi tramite


Precision of Numeric Data Types

The following OLE DB data types are used to represent numeric values. Each type has a corresponding maximum precision value that indicates the maximum number of base 10 digits that it can store. The radix of the precision for all numeric types is 10.

The maximum precision returned by the provider in the COLUMN_SIZE column of the PROVIDER_TYPES schema rowset is the maximum possible precision for the data type that is supported by the data store. For example, if a data store can support a maximum precision of only 28 for a DBTYPE_NUMERIC column, the provider returns 28, not 38, as the maximum precision.

Note

Only the following data types have a range of scale values:

  • DBTYPE_DECIMAL 0 to 28

  • DBTYPE_NUMERIC 0 to 38

  • DBTYPE_VARNUMERIC -128 to 127

Although generally invalid, the meaning of a precision value of 0 is provider-specific.

Type indicator

Maximum precision

DBTYPE_I1

3

DBTYPE_I2

5

DBTYPE_I4

10

DBTYPE_I8

19

DBTYPE_UI1

3

DBTYPE_UI2

5

DBTYPE_UI4

10

DBTYPE_UI8

20

DBTYPE_R4

7

DBTYPE_R8

15

DBTYPE_CY

19

DBTYPE_DECIMAL

29

DBTYPE_NUMERIC

38

DBTYPE_VARNUMERIC

255