|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10824 does not return more than 256 chars from a varchar
Submitted: 2001-05-11 23:40 UTC Modified: 2001-06-30 14:36 UTC
From: sysadminnospam at cheezy dot net Assigned:
Status: Closed Package: MSSQL related
PHP Version: 4.0.4pl1 OS: MS Windows 2000
Private report: No CVE-ID: None
 [2001-05-11 23:40 UTC] sysadminnospam at cheezy dot net
Queries and stored procedures returning varchar data do not return more than 256 chars. The rest is truncated.

Affected functions: 
  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?



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-30 14:36 UTC]
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.
 [2003-02-24 06:41 UTC] magne at myrtveit dot com
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!

 [2004-01-28 16:54 UTC] php at electricsurfer dot com
There's an easier workaround:
No other changes !
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 22 03:01:29 2024 UTC