Re: Re: Calling MSSQL Stored Procedure

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

 



First, you should be using PrepareSP() instead of Prepare() to call a
stored procedure.  Second, the PHP mssql extension does not appear to be
able to bind directly to a datetime parameter.  If you cannot rewrite the
procedure, then you should install the odbtp extension
(http://odbtp.sourceforge.net) so that you can use the ADODB odbtp driver.

The following code will work with the odbtp driver:

    $SQL = $PMdb->PrepareSP("spGetActivePromotions");
    $ActualDate = time();
    $PMdb->Parameter($SQL, $ActualDate, "Today");
    $PMdb->Parameter($SQL, $ret, 'RETURN_VALUE');

-- bob

On Fri, 16 Sep 2005, Alf Stockton wrote:

> Mark Rees wrote:
>
> >
> >
> >The type problem in not in PHP but in SQL Server. The sp expects an input
> >parameter of type datetime, and it isn't getting one.
> >
> >http://www.php.net/function.mssql-query has the answer to this question,
> >which is to supply the parameter as varchar and use CONVERT in the sp to
> >change it into a datetime
> >
> >
> >
> As other programs, not under my control, are already using that Stored
> Procedure altering it is really not a good idea.
>
>
> --
>
> Regards,
> Alf Stockton		www.stockton.co.za
>
> Good day for overcoming obstacles.  Try a steeplechase.
>
> My email disclaimer is available at www.stockton.co.za/disclaimer.html
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux