Re: [PHP] mssql_bind question

2012-04-09 Thread David OBrien
On Mon, Apr 9, 2012 at 1:42 PM, David Stoltz  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


[PHP] mssql_bind question

2012-04-09 Thread David Stoltz
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



[PHP] mssql_bind Question

2009-08-19 Thread David Stoltz
Code in question:
mssql_bind($stmt,
'@managerName',$managerName,SQLVARCHAR,false,false,50);

For a normal varchar field, the length is obvious, in this case 50.

But for an ntext field, how do I use the mssql_bind statement?

Far as I know, these are the only available "types" to use:
SQLTEXT, SQLVARCHAR, SQLCHAR, SQLINT1, SQLINT2, SQLINT4, SQLBIT,
SQLFLT4, SQLFLT8, SQLFLTN

I need to use which type, and what length to use...?

Thanks for any advice...


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php