freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "James Harper" <james.harper AT bendigoit.com.au>
- To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
- Subject: [freetds] tds.h and systypes
- Date: Sun, 29 Jan 2006 12:21:51 +1100
When I have a look at the systypes table in the sql server 2000 master
database, I see 4 columns depicting types: 'type', 'usertype', 'xtype',
and 'xusertype'.
Taking varchar as an example, it has type = 39, usertype = 2, xtype =
167, xusertype = 167. 167 = 39 + 128, and I seem to remember reading in
some of the source that with bit 7 set it denotes a 'large' type and
uses a smallint to depict length instead of a byte.
tds.h defines SYBVARCHAR = 39 and XSYBVARCHAR = 167. Is it just two
numbers for the same type, or are they actually different types?
Why do the two types exist? My first guess would be that the SYBVARCHAR
is for older protocol version (<7?), and XSYBVARCHAR is for newer (>=
7)?
If that's the case, obviously the old protocol version won't understand
any of the new types, but does the new protocol accept the old types?
Some testing shows that it does...
Then there appears to be the SYBINTN = 38 (nullable integer) which
doesn't appear at all in the systypes table. What's with that? Is it a
Sybase but not Microsoft type?
Another question, if I want to place a character string in a result set
to send to the client, and there isn't an indication from the client as
to what type to use, how do I determine the type? Do I just use
XSYBVARCHAR, or should I use SYBVARCHAR if the length is < 255 and
XSYBVARCHAR if the length is > 255?
More to come once I have a better understanding of the above :)
Thanks
James
-
[freetds] tds.h and systypes,
James Harper, 01/28/2006
- Re: [freetds] tds.h and systypes, Frediano Ziglio, 01/29/2006
Archive powered by MHonArc 2.6.24.