Export (0) Print
Expand All
1 out of 1 rated this helpful - Rate this topic

ODBC Datetime Format

SQL Server 2000

ODBC Datetime Format

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' }

literal_type

Specifies the type of the escape sequence. Timestamps have three literal_type specifiers:

d = date only

t = time only

ts = timestamp (time + date)

'constant_value'

Is the value of the escape sequence. constant_value must follow these formats for each literal_type.

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.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.