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

 ID:                 43110
 Updated by:         yohg...@php.net
 Reported by:        lhelmer at suezenergyna dot com
 Summary:            MSSQL_BIND won't work with datetime parameter
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            MSSQL related
 Operating System:   Win2003
 PHP Version:        5.2.4
 Block user comment: N
 Private report:     N

 New Comment:

Please try using this snapshot:

  http://snaps.php.net/php5.4-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/




Previous Comments:
------------------------------------------------------------------------
[2008-01-21 22:36:00] leo dot avatar at hoptmail dot com

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

------------------------------------------------------------------------
[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 https://bugs.php.net/bug.php?id=43110&edit=1

Reply via email to