C to SQL conversion for time data

You can convert the time C data type, SQL_C_TYPE_TIME, to an SQL data type.

The following table shows information about converting time C data to SQL data.

Table 1. Conversion of time C data to SQL data
fSqlType Test SQLSTATE
SQL_CHAR SQL_VARCHAR Column length >= 8 000001
Column length < 8 22003
SQL_TYPE_TIME Data value is a valid time 000001
Data value is not a valid time 22008
SQL_TYPE_TIMESTAMP2 Data value is a valid time 000001
Data value is not a valid time 22008
SQL_TYPE_TIMESTAMP_WITH_TIMEZONE3 Data value is a valid time 000001
Data value is not a valid time 22008
Notes:
  1. SQLSTATE 00000 is not returned by SQLGetDiagRec(), rather it is indicated when the function returns SQL_SUCCESS.
  2. The date component of TIMESTAMP is set to the system date of the machine at which the application is running.
  3. The date component of TIMESTAMP is set to the system date of the machine at which the application is running, and the time fraction is set to zero. 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.