Link to home
Start Free TrialLog in
Avatar of Bob Schneider
Bob SchneiderFlag for United States of America

asked on

Converting Stored Procedure to SQL Statement

Does anyone see anything wrong with this query syntactically?  I am trying to convert a stored procedure query to an "in page" classic asp query in order to get a json/jquery page to work.

Thanks in advance!

sql = "SELECT TOP " & iLength & " PR.Bib, P.FirstName, P.LastName, P.Gender, PR.Age, IR.ChipTime, IR.FnlTime, IR.ChipStart, P.City, P.St "
sql = sql & "FROM RaceData AS R INNER JOIN PartRace AS PR ON R.RaceID = PR.RaceID INNER JOIN Participant AS P ON PR.ParticipantID = P.ParticipantID "
sql = sql & "INNER JOIN (SELECT DISTINCT RaceID, ParticipantID, ChipTime, FnlTime, ChipStart, FnlScnds FROM IndResults WHERE FnlTime IS NOT NULL "
sql = sql & "AND FnlTime > '00:00:00.000') AS IR ON R.RaceID = IR.RaceID AND P.ParticipantID = IR.ParticipantID WHERE R.RaceID = " & lRaceID
sql = sql & " ORDER BY " & sSortBy & " " & sSortDir

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bob Schneider

ASKER

Thanks for the help!