Re: Re: Calling MSSQL Stored Procedure

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

 



M. Sokolewicz wrote:

Alf Stockton wrote:

Mark Rees wrote:


I get 2005/09/16 10:09:22 AM which is exactly the same format as it
appears in the database table when viewed via Enterprise Manager.



I wouldn't set too much store by how it looks in EM. It is a datetime value,
so its internal representation will be quite different.

It seems likely that $actualdate isn't actually a datetime by the time it
gets to the database, for whatever reason.

Note this line from the adodb docs: (I am presuming you are using ADODB for
PHP here)

If $type parameter is set to false, in mssql, $type will be dynamicly
determined based on the type of the PHP variable passed (string => SQLCHAR,
boolean =>SQLINT1, integer =>SQLINT4 or float/double=>SQLFLT8).

http://phplens.com/lens/adodb/docs-adodb.htm

I would look into supplying the data type when adding the parameter
Please suggest what data type you would use. In the database the requisit field is a datetime but I cannot find in either adodb or php document a datetime type. A little further down in the manual you refer to above it says interalia:- [$*type*] Consult mssql_bind <http://php.net/mssql_bind> and ocibindbyname <http://php.net/ocibindbyname> docs at php.net for more info on legal values for type. and neither mssql_bind <http://php.net/mssql_bind> nor ocibindbyname <http://php.net/ocibindbyname> led me to a list of types but looking at GetType gave me the following list?????

   *

     "*boolean*
     <http://www.php.net/manual/en/language.types.boolean.php>" (since
     PHP 4)

   *

"*integer* <http://www.php.net/manual/en/language.types.integer.php>"

   *

     "*double* <http://www.php.net/manual/en/language.types.float.php>"
     (for historical reasons "double" is returned in case of a *float*
     <http://www.php.net/manual/en/language.types.float.php>, and not
     simply "float")

   *

     "*string* <http://www.php.net/manual/en/language.types.string.php>"

   *

     "*array* <http://www.php.net/manual/en/language.types.array.php>"

   *

     "*object* <http://www.php.net/manual/en/language.types.object.php>"

   *

     "*resource*
     <http://www.php.net/manual/en/language.types.resource.php>" (since
     PHP 4)

   *

     "*NULL* <http://www.php.net/manual/en/language.types.null.php>"
     (since PHP 4)

   *

     "user function" (PHP 3 only, deprecated)

   *

     "unknown type"


Please tell me what I should use ?

use a string. Besides, forget all about types in PHP. PHP converts between them automatically... what would you need to know what "type to use" anyway? :) I can't (or barely) imagine any PHP code in which you can *define* what type something is supposed to be (except by casting something to another type explicitly; which is usually pretty pointless)

I accept what you are saying but then what is wrong with my original code?
  $PMdriver = "mssql";
  $PMdb = ADONewConnection($PMdriver);
  $PMdb->Connect($PMserver, $PMuser, $PMpassword, $PMdatabase);
  $SQL = $PMdb->Prepare("spGetActivePromotions");
  $ActualDate = strftime("%Y/%m/%d %I:%m:%S %p");
  $PMdb->InParameter($SQL, $ActualDate, "Today");
  $PMdb->OutParameter($SQL, $ret, 'RETVAL');
why do I keep getting:-
201: Procedure 'spGetActivePromotions' expects parameter '@Today', which was not supplied. No matter how I define the variable, as Today or as @Today or as 'Today' or as "Today" or as '@Today' or as "@Today"

--

Regards,
Alf Stockton		www.stockton.co.za

Stay away from flying saucers today.

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