Re: Re: Calling MSSQL Stored Procedure

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

 



> > 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?????
> >
> >    *
> > > > 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)

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

-- 
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