C to SQL conversion for timestamp data
You can convert the timestamp C data type, SQL_C_TYPE_TIMESTAMP, to an SQL data type.
The following table shows information about converting timestamp C data to SQL data.
| fSqlType | Test | SQLSTATE |
|---|---|---|
![]() SQL_CHAR
SQL_VARCHAR ![]() |
Column length >= Display size![]() |
000001![]() |
| 19 <= Column length < Display size | 01004 | |
| Column length < 19 | 22003 | |
| Fractional seconds field length > 12 (display size > 32) | 22008 | |
| SQL_TYPE_DATE | Data value is a valid date, and time fields are 0 | 000001 |
| Data value is a valid date, and time fields are not 02 | 01004 | |
| Data value is not a valid date | 22008 | |
| SQL_TYPE_TIME | Data value is a valid time. Fractional seconds fields are zero. | 000001 |
| Data value is a valid time. Fractional seconds fields are not zero. | 01004 | |
| Data value is not a valid time. | 22008 | |
SQL_TYPE_TIMESTAMP![]() |
Data value is a valid timestamp![]() |
000001![]() |
Data value is not a valid timestamp![]() |
22008![]() |
|
Precision specified by TIMESTAMP(p) <
fractional seconds field length <= 124![]() |
000001![]() |
|
| Notes:
|
||

