Thanks,sleipnir214
I found it. Post here.
spotspaperdoll at yahoo dot com
If you have difficulty using mssql_query to retrieve *long* text values stored as VARCHAR/CHAR data on your SQL server, try the following.
[This is different than retrieving beyond the 4096 character SQL TEXT data type problem (with resolution) mentioned above.]
Specifically, retrieving text values longer than 256 characters can be a problem.
For example, if you have:
SQL table "WebComments": UserID [int], UserComments [varchar(4000)]
with the data: 100, 'blah blah blah blah...going on for 3000 characters..."
Unless you're lucky, when you execute the following code:
[...]
$SQL="select UserID, UserComments from WebComments where UserID=100";
$Result=mssql_query($SQL, $LinkID);
$Data=mssql_fetch_array($Result);
echo $Data["UserComments"];
only the first 255-ish characters of the UserComments field value will be displayed.
To get around this problem, you can change your database to use SQL TEXT data types instead, but that would be a pain.
To get around this without changing your database, change your initial query to:
$SQL="select UserID, convert(text,UserComments) as UserComments from WebComments where UserID=100";
and keep the rest of the PHP code the same. Now when you execute the code, the entire UserComments field value should be displayed on your screen.
The length of the data displayed should only be limited by your SQL connection's TEXTSIZE value (that defaults to 4096 characters on SQL 7.0) as indicated in the above message regarding surpassing the 4096 character limit for SQL TEXT fields.
On a related note, if you're testing this type of thing using the SQL Query Analyzer, by default, the Query Analyzer will only show you up to 256 characters per field at a time. You may not notice any differences in your testing unless you change the Query Analyzer's display to > 256 characters. Look under Query/Current Connection Options.../Advanced/Maximum characters per column off the Menu Bar to change this value.