[freetds] Setting for returned column size in FreeTDS?

Ken Tozier kentozier at comcast.net
Fri Aug 18 01:47:19 EDT 2006

On Aug 18, 2006, at 1:03 AM, Frediano Ziglio wrote:

> Il giorno gio, 17/08/2006 alle 18.11 -0400, Ken Tozier ha scritto:
>> Well I checked into this today and although I wasn't able to solve
>> the 255 character limit, I did discover that it only exists when
>> retrieving data from MSSQL. I can write large strings without problem
>> (Verified by looking at the database with Query Analyzer)
>> I don't know whether this is a FreeTDS issue or a MSSQL one but if it
>> sounds like a FreeTDS issue, what other steps would you recommend?
>> The actual usage scenario goes like this
>> 1. Mac OS X application sends a request to a PHP script.
>> 2. PHP script packages up the request into an SQL query and sends it
>> off to MSSQL
>> 3a. If the request was an insert, it completes successfully
>> regardless of data length
>> 3b. If the request is a select, I get back the full contents of
>> fields shorter than 255 characters but all fields 256 characters or
>> longer get truncated to 255
>> Of note is that all queries, both insert and select, work as expected
>> with MySQL so it's not a problem with the SQL (I do make the
>> necessary query syntax changes for MSSQL)
>> Thanks
>> Ken
> As said is a configuration problem. Try with this line
> putenv('TDSVER=7.0');
> before PHP connection. You are using an old protocol that do no  
> support
> more than 255 characters on strings. You are able to insert more than
> 255 cause sql statements sent to server have not this limit.
> freddy77

Thanks Freddy

I already set all copies on freetds.conf on our server to use

# A typical Microsoft SQL Server 2000 configuration
	host = <correct domain here>
	port = 1433
	tds version = 8.0

But it didn't work still getting 255 char truncation. I want to avoid  
environment variables as they are extremely confusing and hard to  
find for non unix folks and  the maintainers for this project have  
even less unix experience than I do.

Unless I'm missing something, setting tds version = 8.0 should have  
fixed the problem but the fact that it didn't means there is some  
other hidden variable somewhere, perhaps not even in freetds that is  
causing the truncation.


> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds

More information about the FreeTDS mailing list