Originally posted by surf741
I have a problem when querying a varchar texfield form an MS SQL database. although the data is stored correctly in the database, it is truncated after about 256 chars from the beginning when receyved by PHP. ...
I have experienced the same problem, and I just found a solution to it.
PHP's MSSQL supports updating tables with strings with more than 255 characters.
However, retrieved strings will be truncated to 255 characters if the corresponding table field is of type char or varchar.
Solution 1: Define your SQL long string database fields using text.
Solution 2: Trick the MSSQL DB library into believing that it receives a text when it is actually receiving a char or varchar string. Example:
$result = mssql_query("select convert(text, S) as S from T, $connection);