The ODBC API defines escape sequences to represent date and time values, which ODBC calls timestamp data. This ODBC timestamp format is also supported by the OLE DB language definition (DBGUID-SQL) supported by the Microsoft OLE DB Provider for SQL Server. Applications using the ADO, OLE DB, and ODBC-based APIs can use this ODBC timestamp format to represent dates and times.
ODBC timestamp escape sequences are of the format:
{ literal_type 'constant_value' }
d = date only.
t = time only.
ts = timestamp (time + date).
literal_type | constant_value format |
---|---|
d | yyyy-mm-dd |
t | hh:mm:ss[.fff] |
ts | yyyy-mm-dd hh:mm:ss[.fff] |
These are examples of ODBC time and date constants:
{ ts ‘1998-05-02 01:23:56.123’ }
{ d ‘1990-10-02’ }
{ t ‘13:33:41’ }
Do not confuse the ODBC and OLE DB timestamp data type name with the Transact-SQL timestamp data type name. The ODBC and OLE DB timestamp data type records dates and times. The Transact-SQL timestamp data type is a binary data type with no time-related values.