Re: Re: Calling MSSQL Stored Procedure

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

 



>
> >>I have to access a MsSQL stored procedure coded as follows :-
> >>
> >>CREATE PROCEDURE spGetActivePromotions
> >>   @Today datetime
> >>AS
> >>SELECT PromotionID, PromotionName, StartDate, EndDate, LastDrawDate,
> >>       MaxDraws, NumRegTickets, VouchersPermitted, NumTicketsPerVoucher,
> >>ManualTicketIssue
> >>   FROM Promotion
> >>   WHERE @Today>=StartDate AND @Today<=EndDate
> >>GO
> >>
> >>and therefore have coded my php as follows :-
> >>
> >>    $PMdriver = "mssql";
> >>    $PMdb = ADONewConnection($PMdriver);
> >>    $PMdb->Connect($PMserver, $PMuser, $PMpassword, $PMdatabase);
> >>    $SQL = $PMdb->Prepare("spGetActivePromotions");
> >>    $ActualDate = strftime("%Y/%m/%d %I:%m:%S %p");
> >>
> >>
> >
> >what does echo $ActualDate give you?
> >
> >
> >
> 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

Hope this helps

Mark

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