PHP MSSQL and text datatypes

  • I recently converted my website database from MySQL to MS SQL and I have experienced some problems. The thing is that I use the text datatype to store the content of forum messages in. But that causes a limit of 4096 characters and that is not enough. I have tried to change the datatype to varchar(8000) but the MSSQL extension for PHP can't let me get more then 255 characters with varchar. If I use a CONVERT(text, post_text) in my select-sentence the 4096 limit MS SQL kicks in.

    What can be done in this situation?

    Situation: PHP 5.0, ISS 6.0, MS SQL 2000. Need to store and retrieve large amounts (>4096) of text from database.

  • i'm quoting http://www.interactivetools.com/iforum/Open_Source_C3/htmlArea_v3.0_-_Beta_Release_F14/PHP,_MS_SQL_Max_Size_(Limit)_of_Text_P33639/

    :

    'The problem occures at about 4,000 chars and comes from an entry in php.ini:

    mssql.textlimit,

    mssql.textsize

    are set to 4096 chars by default. This means that the PHP function for fetching results from MS SQL will only fetch contents of rows until 4096 chars. This settings won't have any effect on storage and/or saving larger text sizes. If you want to get rid of this problem, simply set mssql.textlimit and mssql.textsize to somthing larger. MS SQL supports within "text" fields 2,000,000 (!!) chars.... '

    This is a royal pain in sqlserver/php apps...

    Another very clunky workaround is to extract the text up to the limit in blocks than stitch them back togther in PHP. 

     

     

     

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply