>The following select statement works fast from the command window, however it is noticably slower in my form. It is optimizing all the indexes.
>
>SELECT Scorder.ord_acct, Scorder.ord_order, scordln.orl_qty-scordln.orl_qtypicked-scordln.orl_qtyrec as qtyonorder;
>FROM scorder LEFT OUTER JOIN scordln ;
>ON Scorder.ord_order = Scordln.orl_order ;
>where scorder.ord_acct < 200 and upper(scordln.orl_sku) = upper(tcSku) and scordln.orl_dunn # "X";
>into cursor cTemp
>
>I changed my form to use the following scan and insert. It is a lot faster.
>
>select scordln
>scan for upper(scordln.orl_sku) == upper(tcSku) and scordln.orl_dunn # 'X'
> =seek(scordln.orl_order,'scorder','ord_order')
> if scorder.ord_acct < 200
> insert into cstockorder(cst_acct , cst_order , cst_qty) ;
> values (scorder.ord_acct, scorder.ord_order, scordln.orl_qty-scordln.orl_qtypicked-scordln.orl_qtyrec)
> endif
>endscan
>
>Is a scan & insert normally faster than a select into a cursor?
>
>Thanks
>
>Pat
One tiny thing in addition to Ed comments: if tcSku is a parameter (not the field), you can upper it before the SQL, e.g. tcSku=upper(tcSku) and save one function in SQL. Of course, it's a minor observation and would not gain you much speed...
If it's not broken, fix it until it is.
My Blog