#16496 [Opn->Fbk]: Stored Procedure Parameters is_null issue
| From: | iliaa@php.net | Date: | Sat, 07 Dec 2002 07:53:07 +0000 |
| Subject: | #16496 [Opn->Fbk]: Stored Procedure Parameters is_null issue | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-26963@lists.php.net to get a copy of this message | ||
ID: 16496
Updated by: iliaa@php.net
Reported By: arthur.mcgibbon@btinternet.com
-Status: Open
+Status: Feedback
Bug Type: MSSQL related
Operating System: Win2000
PHP Version: 4.1.2
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2002-04-08 11:54:31] arthur.mcgibbon@btinternet.com
The problem is with executing a stored procedure with a null-value
varchar output parameter.
Steps...
1) create any SP that has a varchar(200) input/output param
e.g.
create procedure Test
(
@TestVarchar varchar(200) = null output
)
as
select @TestVarchar = 'Successful parameter feedback';
2) Run stored procedure using following statements...
$ConnectionObj = mssql_connect($DB_SERVER_NAME, $DB_USER,
$DB_PASSWORD);
$aStatement = mssql_init("dbo.test", $ConnectionObj);
mssql_bind($aStatement, "RETVAL", &$RetVal, SQLINT4);
mssql_bind($aStatement, "@TestVarchar", &$Value, SQLVARCHAR, TRUE,
TRUE, 200);
$ExecResult = mssql_execute($aStatement);
When PHP executes the SP it defines the parameter as VARCHAR(0) when it
should be VARCHAR(200).
I've run SQL Profiler and it shows...
declare @P1 varchar(0)
set @P1=NULL
exec dbo.test @P1 output
select @P1
when it should be
declare @P1 varchar(200)
set @P1=NULL
exec dbo.test @P1 output
select @P1
If you change the bind statement so that the @TestVarchar parameter is
not null then the whole thing works.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=16496&edit=1