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.

Table 1. Conversion of 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 <= 123 000001
SQL_TYPE_TIMESTAMP_WITH_TIMEZONE4 Data value is a valid timestamp 000001
Data value is not a valid timestamp 22008
Precision specified by TIMESTAMP(p) < fractional seconds field length <= 123 000001
Notes:
  1. SQLSTATE 00000 is not returned by SQLGetDiagRec(), rather it is indicated when the function returns SQL_SUCCESS.
  2. The time portion of the timestamp is deleted.
  3. Fractional seconds of the timestamp are truncated.
  4. The time zone component of TIMESTAMP is set based on either CLIENTTIMEZONE, SESSIONTIMEZONE, or the current system time zone of the machine the application is running.