Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Question about SQL Server and Stored Procedures...
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00494976
Message ID:
00496401
Views:
25
Daniel,
I have done some of this type conversion and there are lots of ways to do this based on the situation. If these queries are used mostly for reports only, I would build the SQL string in foxpro and pass the string to SQL in a pass-thru statement. You might want to research the CASE statement in SQL which is very different than the Fox Case statement. I hope this at least help points you in a good direction.

lcLabno = .cLabno
lcFilter = [ labbatch.labno = ']+lcLabno+[' AND ]+ ;
[labbatch.dateofserv BETWEEN ']+DTOC(.dStartDate)+[' AND ']+DTOC(.dEndDate)+[' ]
lcOrderBy= [ ORDER BY Labbatch.dateofserv, ]+;
[patname, Labbatch.batchorig, Labbatch.lesionno]

SQLEXEC(1,[SELECT Labbatch.batchno, Labbatch.dateofserv dateofserv, abs.name, ]+;
[Labbatch.batchorig, Labbatch.testname, ]+;
[RTRIM(ISNULL(patient.lname,''))+', '+LTRIM(RTRIM(ISNULL(patient.fname,''))+' ')+RTRIM(ISNULL(patient.mid,'')) patname, ]+;
[patient.patientno, location, SPACE(4) AS measvalue, SPACE(10) AS DESCRIPTION ]+;
[FROM labbatch,batchinfo,labs,patient ]+;
[WHERE labbatch.batchorig = batchinfo.batchorig ]+;
[AND Labbatch.labno = labs.labno ]+;
[AND labbatch.patientno = patient.patientno ]+;
[AND labbatch.doctorno = ']+oWOVar.cPhysician+[' ]+;
[AND ]+lcFilter+lcOrderBy,'lvPatLabFilter')

I apologize for the syntax. I cut this out of a program hoping it might help you. In the were clause of this statement joins should be being used. The idea is here anyway. Good Luck!
Previous
Reply
Map
View

Click here to load this message in the networking platform