Skip to Content.
Sympa Menu

freetds - Re: M$ SQL 7, again ;-)

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Brian Bruns" <camber AT ais.org>
  • To: freetds
  • Subject: Re: M$ SQL 7, again ;-)
  • Date: Fri, 10 Sep 1999 13:50:41


On 09/10/99, "Michael Peppler <mpeppler AT peppler.org>" wrote:
> Paul Schaap writes:
> > Hi,
> >
> > I have a fairly recent CVS freetds which has the following two issues :-
> >
> > 1) With both php and sqsh dates come through incorrectly, i.e.
> > 1> SELECT ID,DateAdded FROM Customer WHERE ID > 10001434
> > 2> \go
> > ID DateAdded
> > -------- -------------------
> > 10001435 Aug 11 1903 06:51AM
> > 10001436 Aug 30 1903 06:51AM
> > 10001437 Nov 25 1903 06:51AM
> >
> > (3 rows affected)
> > 1> SELECT ID,CONVERT(CHAR(20),DateAdded) FROM Customer WHERE ID >
> 10001434
> > 2> \go
> > ID
> > -------- --------------------
> > 10001435 Sep 10 1999 9:32PM
> > 10001436 Sep 10 1999 9:51PM
> > 10001437 Sep 10 1999 11:18PM
> >
> > (3 rows affected)
> > I resolve this by doing a CONVERT right now ! Any ideas how it could be
> > fixed ?
>
> Looks like the first and second word of the DATETIME value are swapped
> on MSSQL7... Remember that a datetime is a struct with two 32bit int
> values, one for days since Jan 1 1900, and one for 300th of seconds
> since midnight.
>

Interesting. I can see I need to test this on big endian. The 32bit values
themselves seem to be byte-ordered correctly. However if it treats dates as
a single 64bit value on the server side it would indeed show this
behaviour. I'll verify against Solaris/Sybase tonight when I get home, but
my feeling is it's wrong there as well. Simple patch if thats the case.

Brian




Archive powered by MHonArc 2.6.24.

Top of Page