Skip to Content.
Sympa Menu

freetds - Re: [freetds] 2008 Data Types For DBLIB

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] 2008 Data Types For DBLIB
  • Date: Fri, 29 Jul 2011 09:54:16 +0200

2011/7/29 Ken Collins <ken AT metaskills.net>:
>
> 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




Archive powered by MHonArc 2.6.24.

Top of Page