Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Speeding Up SPT Statement Process
Message
 
À
04/02/2009 13:57:21
Steven Dyke
Safran Seats USA
Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01379289
Message ID:
01379294
Vues:
20
>I use the following SPT string in a loop through several part numbers at a time. The process is very slow. What can I do to this SPT statement or my data files to make it faster?
>
>
>sql = "Select recseq, CASE WHEN faistatus = 1" +
>					" THEN 'Accepted' WHEN faistatus = 2 THEN 'Rejected' ELSE 'SEE ORIGINAL FAI' END" +
>					" As fais, inspectord, dwgrev, datstmpi From webprddt6.drawmfai mt1" +	
>					" JOIN ( SELECT webprddt6.drawmfai.partno, MAX(webprddt6.drawmfai.datstmpi) AS MaxDate FROM webprddt6.drawmfai Where toolinspr = 0 And conformir = 0 And DATE(datstmpin) is Not NULL GROUP BY webprddt6.drawmfai.partno) mt3" +
>					" ON mt3.partno = mt1.partno AND mt3.MaxDate = mt1.datstmpi" +
>					" Where mt1.partno in('" + arg1.trim() + "','" + pnmod + "','" + modpartno + "','" + arg1.trim().substring(0,11) + "','" + arg1.trim().substring(0,10) + "','" + arg1.trim().substring(0,9) + "','" + arg1.trim().substring(0,8) +
>					"') And toolinspr = 0 And conformir = 0";
>
I suggest you first to use that SELECT in SSMS with Execution plan button clicked.
Then check it and see HOW you could speed it up.
Also with that kind of query you are opened fo SQL injections. Instead of building the real query string use parameters.
And BTW that is NOT a VFP syntax (arg1.trim().substring(0,9)) :-)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform