Re: mssql_bind question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 9, 2012 at 1:42 PM, David Stoltz <Dstoltz@xxxxxxx> wrote:

> Folks,
>
> Having a difficult time using mssql_bind with characters greater than
> 8000...the database field is set to ntext, and I've also tried
> varchar(max), both seem to produce the same results:
>
> If I use:
> mssql_bind($stmt, '@mgrnotes',$mgrnotes,SQLVARCHAR,false,false,8000);
>
> I get the error:
> Warning: mssql_bind() [function.mssql-bind]: Unable to set parameter in
> D:\Inetpub\wwwroot\folder\mypage.php on line 105
>
> I discovered changing SQLVARCHAR to SQLTXT, and dropping the length of
> 8000 helps:
> mssql_bind($stmt, '@mgrnotes',$mgrnotes,SQLTEXT,false,false);
>
> I get no error, but the field is truncated to 8000 characters
> regardless.
>
> What is the correct way to use mssql_bind with strings of greater than
> 8000 characters?
>
> Thanks!
> Dave
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
this is a limit in SQL itself not the drivers

http://msdn.microsoft.com/en-us/library/aa258848(v=SQL.80).aspx

Using EXECUTE with a Character String

Use the string concatenation operator (+) to create large strings for
dynamic execution. Each string expression can be a mixture of Unicode and
non-Unicode data types.

Although each [N] '*tsql_string*' or *@string_variable* must be less than
8,000 bytes, the concatenation is performed logically in the SQL Server
parser and never materializes in memory. For example, this statement never
produces the expected 16,000 concatenated character string:

EXEC('name_of_8000_char_string' + 'another_name_of_8000_char_string')

Statement(s) inside the EXECUTE statement are not compiled until the
EXECUTE statement is executed.

Changes in database context last only until the end of the EXECUTE
statement. For example, after the EXEC in this example, the database
context is *master*:

USE master EXEC ("USE pubs") SELECT * FROM authors

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux