Re: 2008 Data Types For DBLIB
Frediano Ziglio <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <CAHt6W4dgK72g8y73Ae61A9VyUR9B07muton9pvybhDtyRM=b9w@mail.gmail.com> |
2011/7/29 Ken Collins <[email protected]>: > > On Jul 28, 2011, at 5:06 PM, James K. Lowden wrote: > >>> Does anyone think they will be needing or working on supporting these >>> data types [date], [datetime2], [datetimeoffset], and [time] using >>> DBLIB? Right now they come back to me as SYBTEXT >> >> Needing, yes, working on, no. >> >> It's not a db-lib issue. It's a protocol issue: unless the client >> defines itself as using TDS 7.3, the server returns those types as >> varchar strings. The client never sees tbem in binary form. >> See my message of 11 May 2011, "What's new list in FreeTDS 0.91 and >> 0.92". > > That's fine. I can parse the strings and do something meaningful for the time being, but I can not find a way to get the column type. For instance, the dbprtype() just returns "char" for these columns and dbcolutype() just returns 0/null. Any work arounds for a DBLIB interface to get something back like "datetime2" for the column name or something that let's me switch and parse the varchar string? > > - Ken > Sorry but currently there is no way. datetime2 is supported by tds protocol 7.3 which is not supported by FreeTDS. So you connect with a lower protocol (which is limited to 7.1 in dblib) and server convert silently your column to varchar. The only way to get the correct type would be to do a different query like http://markmintoff.com/2011/06/getting-column-information-using-t-sql/ Frediano _______________________________________________ FreeTDS mailing list [email protected] http://lists.ibiblio.org/mailman/listinfo/freetds