ID:               45551
 Updated by:       [EMAIL PROTECTED]
 Reported By:      brack at wjp dot de
-Status:           Feedback
+Status:           Bogus
 Bug Type:         MSSQL related
 Operating System: Windows Vista Business
 PHP Version:      5.2.6
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

The Microsoft library used to connect to MSSQL databases does not
support varchar columns longer than 255 bytes.

Use the freetds version of the extension (php_dblib.dll) instead.


Previous Comments:
------------------------------------------------------------------------

[2008-10-06 22:07:11] [EMAIL PROTECTED]

Your example looks wrong then, because the first output is produced by:
echo strlen($string).

------------------------------------------------------------------------

[2008-07-18 08:23:22] brack at wjp dot de

Same problem occurs on MS SQL Server 2000!

------------------------------------------------------------------------

[2008-07-18 06:33:58] brack at wjp dot de

Description:
------------
On SQL Server 2005 when I execute a SELECT query to retrieve the
content of a VARCHAR field with a specified length greater than 255 and
less than MAX, the resulting value is truncated at a length of 255
characters.

Reproduce code:
---------------
For testing purposes, I used a table created by the following SQL
code:

CREATE TABLE [TESTTABLE](
        [id] [int] NOT NULL,
        [testvalue] [varchar](1000) NULL,
 CONSTRAINT [PK_TESTTABLE] PRIMARY KEY CLUSTERED 
(
        [id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY
= OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

PHP test script code:

$conn = mssql_connect('localhost', 'testuser', 'testpassword');
mssql_select_db('testdb');
$string =
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
echo strlen($string) . '<br>';
mssql_query('INSERT INTO TESTTABLE (id, testvalue) VALUES (1, \'' .
$string . '\')');
$result = mssql_query('SELECT testvalue FROM TESTTABLE WHERE id=1');
echo(strlen(mssql_result($result, 0, testvalue')));

Expected result:
----------------
Expected output of the PHP test script:

396
396

Actual result:
--------------
Actual output of the PHP test script:

255
396


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45551&edit=1

Reply via email to