Online Shopping : Computers : Programming : Languages : PHP : Database Backed Sites : MSSQL

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

40 of 52 people (77%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

Why is my text insert into MSSQL being truncated?

Aug 2nd, 1999 23:49
Nathan Wallace, Matt Gregory,


the mssql module uses two parameters in php3.ini to control the size and
limit of text columns.
    mssql.textsize = 4096    (0-64kb)
    mssql.textlimit = 4096    (0-2Gb)
try setting one or both params.
The max total length of a row on MSSQLServer 6.5 is 1738 or so chars
(~8100 on 7.0).  If you are inserting into a BLOB (VARCHAR or VARBINARY)
you have to issue a set textsize=(up to 32768 or whatever the max
configured in the SQLServer) statement to tell it the maximum amount you
will transfer at a time.  Plus you have to do an insert on the row where
the blob is to be stored and then a select to get the textpointer for
the just inserted row followed by a writetext loop to insert the actual
data.  You end up assembling a series of writetext statements with
offsets, lengths, and data in the servers buffer then hit it with an
execute.  It is not real clean but we do it all the time in production. 
Have been using the same code since 4.21.08.  It came out in the
SQLServer programmers toolkit as a VB image insert/read example.