From: Python <py...@ve...> - 2006-09-24 08:15:20
|
On Sat, 2006-09-23 at 09:50 -0400, Python wrote: > On Fri, 2006-09-22 at 16:02 -0400, Python wrote: > > I am running Linux (Fedora 3) with > > sybase 0.37 > > freetds 0.63 > > to collect data from a remote Microsoft SQL server. There is at least > > one field that is truncated to 255 characters as I read it: > > (curs.fetchone()) > > > > The curs.description shows: > > ('Features', 1, 0, 255, 0, 0, 1) > > ('Remarks', 1, 0, 255, 0, 0, 1) > > > > However, those fields are actually defined as varchar(350). > > > > Is this a limitation in the modules? Am I doing something wrong? > > I tracked down the issue to freetds. It limits varchar fields to 255 > chars. The freetds site recommends converting or casting the fields to > text. > > http://www.freetds.org/userguide/troubleshooting.htm#KNOWNISSUES > has the details. > > > Should I be using a different set of modules to connect a Python program > > to a remote Microsoft SQL server? By configuring a server into the /etc/freetds.conf file, I was able to specify a different protocol version and the varchar sizes are now reported properly. In summary, I did not use the CAST(column AS TEXT) advice, but instead added a server definition to the freetds.conf file using the following as a model. # A typical Microsoft SQL Server 2000 configuration ;[MyServer2k] ; host = ntmachine.domain.com ; port = 1433 ; tds version = 8.0 -- Lloyd Kvam Venix Corp |