[freetds] Server - Problems with TDS 4.2 COLFMT token

Steve Kirkendall skirkendall at dsl-only.net
Mon May 17 13:10:35 EDT 2004


"James K. Lowden" <jklowden at schemamania.org> wrote on Sunday, May 16, 2004:
> On Sat, 15 May 2004, Steve Kirkendall <skirkendall at dsl-only.net> wrote:
> > 3) For "timestamp", the SQL_DATETIME_SUB and INTERVAL_PRECISION columns
> >    in sp_datatype_info's result table are null.  So that probably isn't
> >    why Crystal Reports is truncating timestamps at 8 characters.  One
> >    weird thing: your server reports "timestamp" as being generic binary
> >    (type code -2) instead of ODBC timestamp (type code 11).
> 
> If you look in the ML archives, you'll find a short thread a few months
> ago about timestamp data as it relates to BCP.  IIRC, the only way a
> client knows it's got a timestamp column -- as opposed to, say, a generic
> binary -- is that the server sets the usertype to 50.  You'll find some
> brief mentions of that in Sybase's TDS functional specs, and, less
> plainly, in Microsoft's documentation.  

Very odd.  So the SYBDATETIME type code isn't used at all?  Is that
part of the TDS protocol definition, or is it just a common bug in
the Sybase and MS SQL servers?

I'm sending timestamps as SYBDATETIME, and it almost works.  The
timestamps look exactly right in tsql.  In Crystal Reports' "Query
Generator", the value does show as a timestamp, and I think the date
is correct but it is truncated at 8 characters.  For example, I see
"2004-04-" when I expect to see "2004-04-12 08:15:00".  The column
seems to have the right width, but the displayed values are just too
short.

In other news, I didn't quite finish my server library changes.
I found a bug in the tds_env_change() function, and I'm trying to
figure out what to do about it.  The bug is that for some environment
types, it sends the TDS_ENVCHANGE_TOKEN but no data.  I'm hoping this
is the source of at least some of the  "Protocol error in TDS data
stream" errors that I get when I try using the MS SQL Server ODBC
driver to access my server.

On the bright side, I've received permission to make my little server
be open source, so we have that to look forward to.

-- 
Steve Kirkendall    |A:It is confusing, since people don't read that way
kirkenda at cs.pdx.edu |Q:Why is top-posting bad?
                    |A:It is adding comments to the top of a message
                    |Q:What is top-posting?



More information about the FreeTDS mailing list