[freetds] Setting for returned column size in FreeTDS?

Frediano Ziglio freddyz77 at tin.it
Fri Aug 18 01:03:06 EDT 2006


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





More information about the FreeTDS mailing list