ODBC timestamp formats in T-SQL

Tech-Archive recommends: Fix windows errors by optimizing your registry



This works in SQL 2005 T-SQL:

Select {d '1980-01-01'} As Temp

I understand that this is known as the "ODBC timestamp literal format".

Is this also legal T-SQL? Is it fully supported as T-SQL, deprecated,
recommended, not recommended, or what?

There is an index entry in BOL for SQL 2005 called "ODBC timestamp data",
which oddly enough points to a topic called "ODBC Datetime Format" (even
though "ODBC Datetime Format" doesn't appear in the index). The topic
describes the format and says it can be used by the OLE DB Provider for SQL
Server. Which doesn't make it clear to me that this can be used when
you're writing code in the T-SQL language.

You can put that Select statement into a view and it works fine. I thought
the T-SQL language was separate from ODBC, ADO, OLE DB, etc.!


David Walker
.



Relevant Pages

  • Re: Synchronise sql data to Access
    ... The data returned will be made available in sql ... format. ... the Access database is already set up, the form is yet to be designed. ... but the simplest is to use ODBC. ...
    (microsoft.public.access.queries)
  • Re: AS400 & filter by date
    ... we need to import data from AS400 to MS SQL 2000 via ODBC driver ... (iSeries ODBC by IBM). ... with system date (MS SQL) ... CURRENT_DATE which you would then have to convert to the number format that ...
    (microsoft.public.sqlserver.dts)
  • RE: Bulk Copy / BCP problem....please advise
    ... OpenRowset you can specify the DSNless ODBC Text ... in the T-SQL procedure you setup to import the ... I've even done this in conjunction with an automated FTP ...
    (microsoft.public.sqlserver.programming)
  • Re: ODBC timestamp formats in T-SQL
    ... It relied on the driver (like ODBC) converting the format to something that the database engine understand. ... you do the same test against a higher level SQL Server and you will find that OSQL will not translate the format to a "traditional SQL Server format". ... This ODBC timestamp format is also supported by the OLE DB language definition and the Microsoft OLE DB provider for SQL Server. ...
    (microsoft.public.sqlserver.programming)
  • Re: Prepare, SQL query with to_date call
    ... SQL query with to_date call ... and using Oracle ODBC dsn. ... The Oracle ODBC driver has a problem with date parameters although I'm ... using a date format containing the RR format. ...
    (perl.dbi.users)