ID:               43110
 Comment by:       leo dot avatar at hoptmail dot com
 Reported By:      lhelmer at suezenergyna dot com
 Status:           Open
 Bug Type:         MSSQL related
 Operating System: Win2003
 PHP Version:      5.2.4
 New Comment:

execute stored procedure of mssql server with php5 using parameters
type datetime


Previous Comments:
------------------------------------------------------------------------

[2007-10-26 20:05:10] lhelmer at suezenergyna dot com

Description:
------------
I'm trying to execute a MSSQL stored procedure from PHP and I need to
pass a datetime parameter... when I do this the sp fails.

My bind statement is as follows
mssql_bind($proc,"@RequestDate",$RecDate,SQLVARCHAR,false,false,10);

In a different situation I pass an integer parameter and that sp works.
That bind statement is as follows
mssql_bind($proc,"@Load",$MWLoad,SQLVARCHAR);

I know my stored procedure "CalculateDailyTotals" works because I use
them everday in a scheduled job. It seems the problem is related to
passing a datetime value to the stored procedure.

Reproduce code:
---------------
$RecDate=$_POST['RecalcDate']; // RecalcDate = 2007-10-25

$db = mssql_connect("***","sa","***") or die("Unable to connect to
server");
mssql_select_db("Reporting");
$proc = mssql_init("CalculateDailyTotals", $db);
mssql_bind($proc,"@RequestDate",$RecDate,SQLVARCHAR,false,false,10);

$Result = mssql_execute($proc);
if ($Result == 1){
echo "Succes";
} ELSE {
echo "Failure";
}

Expected result:
----------------
Success

Actual result:
--------------
Failure


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=43110&edit=1

Reply via email to