>Hi all,
>
>I have the following problem with a SQL update:
>
>I populate a temp table and put it threw a SCAN to update my relevant table,it is very slow and would love to speed it up.Is there any way with the current indexes to do so?The speed is about one record every 1 second.
>
>
>SELECT * FROM prodarea;
> INTO CURSOR tmpLoad;
> ORDER BY 1,2;
> NOCONSOLE
> INDEX ON PROD + area TAG PROD
The index on this cursor serves no purpose.
>
>cCounter = 0
>
>SCAN
>
>cCounter = cCounter + 1
>
This is where you need the index... and if you create a similar index as above, you need to use the exact same filter in your WHERE.
So... if you do
INDEX ON po_code + po_docode TAG someTag
your WHERE should be something like this
WHERE po_code + po_docode = tmpLoad.PROD + 'x'
> UPDATE xxx;
> SET po_area = tmpLoad.area;
> WHERE po_code = tmpLoad.PROD AND;
> po_docode = "x"
>
>
>
>
>WAIT WINDOW "Files Updated: " + STR(cCounter) NOWAIT
>
>ENDSCAN
Wayne Myers, MCSD
Senior Consultant
Forte' Incorporated
"The only things you can take to heaven are those which you give away" Author Unknown