IBM Books

Call Level Interface Guide and Reference

ODBC Date, Time, Timestamp Data

The ODBC escape clauses for date, time, and timestamp data are:

    {d 'value'}
    {t 'value'}
    {ts 'value'}
d indicates value is a date in the yyyy-mm-dd format,
t indicates value is a time in the hh:mm:ss format
ts indicates value is a timestamp in the yyyy-mm-dd hh:mm:ss[.f...] format.

For example, the following statement can be used to issue a query against the EMPLOYEE table:

    SELECT * FROM EMPLOYEE WHERE HIREDATE={d '1994-03-29'}

DB2 CLI will translate the above statement to a DB2 format. SQLNativeSql() can be used to return the translated statement.

The ODBC escape clauses for date, time, and timestamp literals can be used in input parameters with a C data type of SQL_C_CHAR.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]