Does this Stored Procedure Syntax look okay?
I'm trying to call it using classic asp with the following code but get an error on calling the stored procedure:
set objComm = Server.CreateObject("ADODB.Command")
objComm.ActiveConnection = sstrDsnString 'You can also just specify a connection string here
objComm.CommandText = "editorTAmonthlyReport" ' stored procedure name
objComm.CommandType = adCmdStoredProc 'Requires the adovbs.inc file or typelib meta tag
'Add Input Parameters to date and from date variables - dtFrom and dtTo
objComm.Parameters.Append.CreateParameter("@.dtFrom", adDate, adParamInput, 9)
objComm.Parameters.Append.CreateParameter("@.dtTo", adDate, adParamInput, 9)
CREATE PROCEDURE editorTAmonthlyReport
@.FromDate DateTime,
@.ToDate DateTime
As
Select
U.UserID,
U.Title,
U.FirstName,
U.Surname,
TAU.UserPosition,
U.Email,
A.AgencyName,
A.AddressLine1,
A.AddressLine2,
A.Town,
A.County,
A.Postcode,
C.Country,
Coalesce(U.Phone,A.Phone) As Phone,
TAU.DateOfCreation
From
[user] U LEFT OUTER JOIN MyTrafalgarUser MTU
ON MTU.userID=U.UserID
INNER JOIN TravelAgencyUser TAU
ON U.UserID=TAU.UserID
INNER JOIN Agency A
ON TAU.AgencyID=A.AgencyID
INNER JOIN Country C
ON A.CountryID=C.CountryID
Where ( u.userid > 34657 AND DateDiff(d,TAU.DateOfCreation, @.FromDate) < 0 )
and datediff(d,TAU.DateOfCreation, @.ToDate) > 0
ORDER BY TAU.DateOfCreation
GO
Hi
Your stored procedure looks good to me .
You can test you stored procedure in SQL Analyser to see if it returns correct records.
|||It's okay, I got it working.
Thanks.
No comments:
Post a Comment