

# Data types and result conversion

ODBC 4.x describes result columns using the SQL type vocabulary for the selected engine. The following mappings apply to DuckDB query results with Unicode type reporting disabled.

The following table lists the reported SQL types and the C types selected for `SQL_C_DEFAULT`.



| DuckDB type | Reported SQL type | Default C type | 
| --- | --- | --- | 
| BOOLEAN | SQL\_BIT | SQL\_C\_BIT | 
| TINYINT / SMALLINT / INTEGER / BIGINT | Matching signed SQL integer type | Matching signed C integer type | 
| UTINYINT | SQL\_SMALLINT | SQL\_C\_SHORT | 
| USMALLINT | SQL\_INTEGER | SQL\_C\_SLONG | 
| UINTEGER | SQL\_BIGINT | SQL\_C\_SBIGINT | 
| UBIGINT / HUGEINT / UHUGEINT | SQL\_DECIMAL | SQL\_C\_NUMERIC | 
| FLOAT / DOUBLE | SQL\_REAL / SQL\_DOUBLE | SQL\_C\_FLOAT / SQL\_C\_DOUBLE | 
| DECIMAL | SQL\_DECIMAL | SQL\_C\_NUMERIC | 
| DATE | SQL\_TYPE\_DATE | SQL\_C\_TYPE\_DATE | 
| TIME / TIME\_NS | SQL\_TYPE\_TIME | SQL\_C\_TYPE\_TIME | 
| TIMESTAMP, TIMESTAMP\_S, TIMESTAMP\_MS, TIMESTAMP\_NS, TIMESTAMPTZ | SQL\_TYPE\_TIMESTAMP | SQL\_C\_TYPE\_TIMESTAMP | 
| BLOB / GEOMETRY | SQL\_VARBINARY | SQL\_C\_BINARY | 
| VARCHAR / CHAR | SQL\_VARCHAR / SQL\_CHAR | SQL\_C\_CHAR | 
| UUID / JSON / BIT / BIGNUM / VARINT / INTERVAL | SQL\_VARCHAR | SQL\_C\_CHAR | 
| LIST / ARRAY / STRUCT / TUPLE / MAP / UNION / VARIANT | SQL\_VARCHAR | SQL\_C\_CHAR | 
| TIME WITH TIME ZONE | SQL\_VARCHAR | SQL\_C\_CHAR | 

## Character and complex columns
<a name="odbc-v4-driver-type-reporting"></a>

Use `StringColumnLength`, `ComplexTypeColumnLength`, and `BinaryColumnLength` to configure reported lengths. Their defaults are `255`, `65535`, and `32767`, respectively.

DuckDB nested values are returned as DuckDB text when read into character buffers. They are not represented as native ODBC array or struct values.

For binary and geometry columns, use `SQL_C_BINARY` to request bytes. When geometry is supplied as well-known text by a text result fetcher, the driver converts it to well-known binary. Character reads of these converted geometry values return hexadecimal text.

For wide character bindings and reported types, see [Unicode type reporting](odbc-v4-driver-advanced-options.md#odbc-v4-driver-unicode-types).

## Numeric precision and temporal scale
<a name="odbc-v4-driver-numeric-temporal-metadata"></a>

The default decimal precision is `20` for `UBIGINT` and `39` for `HUGEINT` and `UHUGEINT`, with scale `0`. Unsigned integer metadata preserves the unsigned attribute even when the reported SQL type is widened.

The default fractional scale is `0` for `TIMESTAMP_S`, `3` for `TIMESTAMP_MS`, `6` for `TIME`, `TIMESTAMP`, and `TIMESTAMPTZ`, and `9` for `TIME_NS` and `TIMESTAMP_NS`. Arrow metadata can supply the physical temporal precision.