[freetds] Server - Problems with TDS 4.2 COLFMT token

Lowden, James K LowdenJK at bernstein.com
Mon May 17 13:45:01 EDT 2004

> From: freetds-bounces at lists.ibiblio.org
> [mailto:freetds-bounces at lists.ibiblio.org]On Behalf Of Steve 
> Kirkendall
> Sent: May 17, 2004 1:11 PM
> "James K. Lowden" <jklowden at schemamania.org> wrote on Sunday, 
> May 16, 2004:
> > 
> > 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?  

On the contrary.  The datatypes TIMESTAMP and DATETIME are two different beasts.  TIMESTAMP  is just a  server-wide monotonically increasing value; it has nothing to do with time.  The server receives a DATETIME as a structure of 2 4-byte integers, whereas timestamps (which it never *receives*) are little SYBBINARY types.  

> 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.

It sounds like it might be a binding/conversion problem.  Wherever the datetime structure is converted to a string, said string has to be large enough to represent the date.  SYBDATETIME is eight bytes, sure, but the resultant string is about 20 characters.  

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

Oh, that is such excellent news!  The project benefits from your work, and you benefit from successive versions of FreeTDS with your work incorporated into it (no patching required).  


The information contained in this transmission may contain privileged and confidential information and is intended only for the use of the person(s) named above. If you are not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, any review, dissemination, distribution or duplication of this communication is strictly prohibited. If you are not the intended recipient, please contact the sender immediately by reply e-mail and destroy all copies of the original message. Please note that we do not accept account orders and/or instructions by e-mail, and therefore will not be responsible for carrying out such orders and/or instructions.
If you, as the intended recipient of this message, the purpose of which is to inform and update our clients, prospects and consultants of developments relating to our services and products, would not like to receive further e-mail correspondence from the sender, please "reply" to the sender indicating your wishes.  In the U.S.: 1345 Avenue of the Americas, New York, NY 10105.

More information about the FreeTDS mailing list