Re: Re: Calling MSSQL Stored Procedure

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

 



Robert Twitty wrote:

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');

Thank you Bob. I decided to try it without the odbtp as I only found source files at http://odbtp.sourceforge.net which looked like they needed building on Linux and my problem does not include Linux. ie Neither the client nor the server is a Linux/Unix machine.

Long story short; your alteration to my code altered the results to the following :-

InParameter($stmt, $php_var='1126950445', $name='Today', $maxLen=4000, $type=56); OutParameter($stmt, $php_var='', $name='RETURN_VALUE', $maxLen=4000, $type=47);
------------------------------------------------------------------------
(mssql): spGetActivePromotions   ||
------------------------------------------------------------------------
8144: Procedure or function spGetActivePromotions has too many arguments specified.

and when I go to google to find out what "8144: Procedure or function" really means I find Microsoft link, support.microsoft.com/?kbid=885712 which tells me :-

You receive this error message in the *Microsoft SQL-DMO (ODBC SQLState: 42000)* dialog box. This problem occurs if there are more than 16 files in the database that you try to attach, including the data files and the log files in the database.

Comments/suggestions please.BTW. The important part of your correction/suggestion was the PrepareSP rather than Prepare and the $ActualDate = time();

--

Regards,
Alf Stockton		www.stockton.co.za

Q:	What is the difference between Texas and yogurt?
A:	Yogurt has culture.

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


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

  Powered by Linux