15.10 - Data Type Mapping - Access Module

Teradata Tools and Utilities Access Module Reference

prodname
Access Module
vrm_release
15.10
category
Programming Reference
featnum
B035-2425-035K

Data Type Mapping

OLE DB uses standard OLE and Windows data types. To describe a data type, an OLE DB type indicator is used, which is a variable of the enumerated type DBTYPE. The Teradata OLE DB Access Module retrieves the C/C++ data type indicated by the OLE DB type indicator and converts the data type to a Teradata Database data type. The Teradata Database data type is based on the DBTYPE and the DBCOLUMNFLAGS values.

Data type mapping is required for transferring data from the Teradata OLE DB providers to the Teradata Database. Table 3 lists the mapping of OLE DB type indicators to Teradata Database data types.

 

Table 3: Mapping OLE DB Data Type to Teradata Database Data Types  

DBTYPE

DBCOLUMNFLAG

Teradata Type

DBTYPE_11

 

BYTE(n)*

DBTYPE_I2

 

SMALLINT

DBTYPE_I4

 

INTEGER

DBTYPE_I8

 

BIGINT

DBTYPE_UI1

 

SMALLINT

DBTYPE_UI2

 

INTEGER

DBTYPE_UI4

 

DECIMAL(10,0)

DBTYPE_UI8

 

BIGINT

DBTPYE_R4

 

FLOAT

DBTYPE_R8

 

FLOAT

DBTYPE_NUMERIC

 

DECIMAL(p,s)*

NUMBER(p,s)*

DBTYPE_DECIMAL

 

DECIMAL(p,s)*

DBTYPE_CY

 

DECIMAL(19,4) for Precision > 18

DECIMAL(18,4) for Precision <= 18

DBTYPE_BSTR

 

VARCHAR(64000)

DBTYPE_IDISPATCH

 

BYTE(n)

DBTYPE_ERROR

 

DECIMAL(10,0)

DBTYPE_BOOL

 

BYTEINT

DBTYPE_VARIANT

 

VARCHAR (8000), SMALLINT ****

DBTYPE_IUKNOWN

 

BYTE(n)**

DBTYPE_GUID

 

BYTE(n)**

DBTYPE_BYTES

DBCOLUMNFLAGS_ISFIXEDLENGTH

BYTE(n)**

DBTYPE_BYTES

 

VARBYTE(n)**

DBTYPE_STR

DBCOLUMNFLAGS_ISFIXEDLENGTH

PERIOD(DATE)

DBTYPE_STR

DBCOLUMNFLAGS_ISFIXEDLENGTH

PERIOD[TIME(p)]

DBTYPE_STR

DBCOLUMNFLAGS_ISFIXEDLENGTH

PERIOD[TIMESTAMP(p)]

DBTYPE_STR

DBCOLUMNFLAGS_ISFIXEDLENGTH

CHAR(n)**

DBTYPE_STR

 

VARCHAR(n)**

DBTYPE_WSTR

DBCOLUMNFLAGS_ISFIXEDLENGTH

CHAR(n)**

DBTYPE_WSTR

 

VARCHAR(n)**

DBTYPE_UDT

 

Unsupported

DBTYPE_DATE

 

TIMESTAMP(p), DATE, & TIME***

DBTYPE_DBDATE

 

DATE

DBTYPE_DBTIMESTAMP

 

TIMESTAMP(p), DATE, & TIME***

DBTYPE_ARRAY

 

Unsupported

DBTYPE_BYREF

 

Indicates the data points to the real data value. For example, DBTYPE_I2 | DBTYPE_BYREF means that the data contains the address of a twobyte integer. All supported types can be referenced by DBTYPE_BYREF.

DBTYPE_VECTOR

 

Unsupported

DBTYPE_RESERVED

 

Unsupported

DBTYPE_NULL

 

Unsupported

DBTYPE_EMPTY

 

Unsupported

DBTYPE_DBTIME

 

TIME

DBTYPE_FILETIME

 

TIMESTAMP(p), DATE, & FLOAT***

DBTYPE_PROPVARIANT

 

Unsupported

DBTYPE_HCHAPTER

 

DECIMAL(10,0)

DBTYPE_VARNUMERIC

 

VARCHAR(n)**

*precision (p) and scale (s).

**n represents the number of bytes for BYTE(n) and VARBYTE(n), and the number of characters for CHAR(n) and VARCHAR(n).

***All date and time data types are split into a Teradata DATE type for the date portion of the data type, and a Teradata TIME for the time portion [in addition to being available as a Teradata TIMESTAMP(p)].

****All DBTYPE_VARIANT types are split into a Teradata VARCHAR(8000) type for the Value portion of the VARIANT structure, and a Teradata SMALLINT for the VT portion.