C to SQL conversion for date data

You can convert the date C data type, SQL_C_TYPE_DATE, to an SQL data type.

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

Table 1. Converting date C data to SQL data
fSqlType Test SQLSTATE
SQL_CHAR SQL_VARCHAR Column length >= 10 000001
Column length < 10 22003
SQL_TYPE_DATE Data value is a valid date 000001
Data value is not a valid date 22008
SQL_TYPE_TIMESTAMP2 Data value is a valid date 000001
Data value is not a valid date 22008
Start of changeSQL_TYPE_TIMESTAMP_WITH_TIMEZONE3End of change Start of changeData value is a valid dateEnd of change Start of change000001End of change
Start of changeData value is not a valid dateEnd of change Start of change22008End of change
Notes:
  1. SQLSTATE 00000 is not returned by SQLGetDiagRec(), rather it is indicated when the function returns SQL_SUCCESS.
  2. The time component of TIMESTAMP is set to zero.
  3. Start of changeThe time component of TIMESTAMP is set to zero. The time zone component of TIMESTAMP is set to 0.End of change