ID: 10824 Comment by: magne at myrtveit dot com Reported By: sysadminnospam at cheezy dot net Status: Closed Bug Type: MSSQL related Operating System: MS Windows 2000 PHP Version: 4.0.4pl1 New Comment:
Here is a workaround that I have used with success. When returning a VARCHAR field F that can exceed 256 characters, I return several computed fields F1, F2, etc using the following SQL query syntax: SELECT ("<" + SUBSTRING(F, 1, 253) + ">") AS F1 , ("<" + SUBSTRING(F, 254, 253) + ">") AS F2 , ("<" + SUBSTRING(F, 507, 253) + ">") AS F3 FROM ... In my PHP code i put F1, F2, F3 together after removing the enclosing <> (which I put on in order to maintain white space at either end of each Fi): $F = substr($F1, 1, -1) . substr($F2, 1, -1) . substr($F3, 1, -1); Good luck! Magne Previous Comments: ------------------------------------------------------------------------ [2001-06-30 14:36:30] [EMAIL PROTECTED] This is not a bug in the php extension. The library used to connect to SQL Server soes not allow warchar columns to be more that 255 char. ------------------------------------------------------------------------ [2001-05-11 23:40:22] sysadminnospam at cheezy dot net Problem: Queries and stored procedures returning varchar data do not return more than 256 chars. The rest is truncated. Affected functions: MSSQL_FETCH_OBJECT MSSQL_FETCH_ARRAY MSSQL_FETCH_ROW (didn't get opportunity to test, but seems likely) I know there was an earlier report similar to this in regards to NCHAR, however, varchar has nothing to do with unicode. Are we looking at the same problem here anyways? Any idea on how long 'til a solution, or some sort of work-around? Using datatype TEXT is NOT an option -- it puts too much overhead on transactions. Since this was classified as a Microsoft problem, I guess upgrading to 4.0.5 would not help, huh? Thanks. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=10824&edit=1