Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: kisss at tdsecurities dot com
Subject: Re: Sybase Client & MS SQL7
Date: Jan 11 2001 7:57PM

Thanks guys.

Strange thing with this issue is that the Sybase Client -> DBlib for Windows NT
works fine with MSSQL7 -> DateTime fields are coming back are correct!

Michael Peppler  on 01/11/2001 12:37:40 PM

Please respond to

To:   SybPerl Discussion List 
cc:    (bcc: Stefan Kiss/CIBG/TDBANK)
Subject:  Re: Sybase Client & MS SQL7 writes:
 > Hello,
 > I have a problem with DateTime columns comning back from Sybperl 2.12,
 > Sybase Client 11.1.1 on Unix from MSSQL7 on NT.
 > I have applied SP1 & SP2 to MSSQL7 and there are no more connection problems.
 > The only problem at the moment is that datetime columns are screwed. I have
 > digged deeper and found out that the problem is with:
 > 1. dbconvert function of DB-lib
 > or
 > 2. dbfetch function of DB-lib
 > because byte - date & time portion are simply switched - D1 D2 T1 T2 should
 > T1 T2 D1 D2. I hacked dblib.c and it works
 > The only thing is that I do access Sybase server as well and I need extra if
 > clause to determine when to switch byte and when not to.

The folks doing the FreeTDS project discovered this problem a while
back. This is a bug with MS-SQL which doesn't convert the data to
network order for datetime columns.

The FreeTDS library has a fix for this (I think). I don't really want
to put that sort of hack into DBlib.xs because it really is dependant
on the server that you connect to, as well as the libraries that you
use (i.e. if you use the FreeTDS libs you should be OK).

The alternative is to change the SQL to use convert(varchar, ) to return char strings instead of datetime values...

Michael Peppler - Data Migrations Inc. - -
International Sybase User Group -
Sybase on Linux mailing list: