Is there a work around (other than changing the column type to a textfield) for SELECTing a large varchar field using PHP and mssql library? For instance a varchar(500). Does PHP really restrict the number of characters to 255? Is there a way to pull back more than that?
From the PHP page, the problem seems to be the underlying database driver on Windows platforms. Varchar can only return < 255 characters. The work around is to cast the varchar to text within the sql SELECT statement.
To cast a wide VARCHAR to TEXT in MS SQL:
SELECT convert(text,myWideField) FROM myTable
Where myWideField is the column being truncated and myTable is well... my table.
The result will be cast to TEXT returning more than 256 chars.
d.
Try to change the freetds configuration.
In the server, edit /etc/freetds.conf
Change:
tds version = 4.2
to:
tds version = 8.0
See more in User Contributed Notes, Mssql Functions Reference.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With