Supported SQL Data Types in OLE DB

The following table shows how OLE DB data types map to the DB2® data types. The OLE DB Table Function wizard defines the appropriate RETURNS TABLE columns in your OLE DB table function, based on the values in this table.

In the three cases where an OLE DB data type maps to multiple DB2 data types, the default DB2 data type that the designer assigns to an OLE DB data column might not be the data type that you want. You can change the DB2 data type of a column to another valid DB2 data type in the Column Mapping page of the OLE DB Table Function wizard.

For example, the OLE DB data type DBTYPE_WSTR maps to four DB2 data types. The wizard assigns the default DB2 data type of GRAPHIC(N) to an OLE DB data column of type DBTYPE_WSTR. You can change the Type property of a DB2 data column from type GRAPHIC to VARGRAPHIC, LONG GRAHIC, or DBCLOB.

OLE DB data type DB2 data type
DBTYPE_I2 SMALLINT
DBTYPE_I4 INTEGER
DBTYPE_I8 BIGINT
DBTYPE_R4 REAL
DBTYPE_R8 FLOAT/DOUBLE
DBTYPE_NUMERIC (p, s) DEC (p, s)
DBTYPE_DBDATE DATE
DBTYPE_DBTIME TIME
DBTYPE_DBTIMESTAMP TIMESTAMP
DBTYPE_STR CHAR(N)
DBTYPE_STR VARCHAR(N)
DBTYPE_STR LONG VARCHAR
DBTYPE_STR CLOB(N)
DBTYPE_BYTES CHAR(N) FOR BIT DATA
DBTYPE_BYTES VARCHAR(N) FOR BIT DATA
DBTYPE_BYTES LONG VARCHAR FOR BIT DATA
DBTYPE_BYTES BLOB(N)
DBTYPE_WSTR GRAPHIC(N)
DBTYPE_WSTR VARGRAPHIC(N)
DBTYPE_WSTR LONG GRAPHIC
DBTYPE_WSTR DBCLOB(N)

Feedback