>>>>Hi Beth,
>>>>
>>>>Evan's message forced me to re-look at your problem. You need to set your relation the other way around from the table you're updating to the extra cursor. This way I hope it will work.
>>>>
>>>Naomi is right...(why am I not surprised)
>>>You need to create the index in BL, SELECT bl731, SET RELATION INTO bl, and then do the REPLACE ALL.
>>>
>>
>>I'm quite surprised, because it's such a rare occurrence :)
>
>Okay, That seems to be working correctly. I am running some more tests, but I found a different update problem to look at.
>
>If I need to start another thread, I will.
>
>I have 2 tables/cursors being updated by another cursor. 1 cursor needs to be updated matching the c1 and c4 info for one field, and another field needs to not match c1 and/or c4 but match the other 3 fields. Should I build the indexes for the matching fields first and run that replace, then build the index with the not matching (and how would I do that?) and run that replace?
>
>Here is the code:
>
>SELECT c5
>SCAN
> UPDATE BL731 SET wrkNbrDate=c5.wrkNbrDate ;
> WHERE srvcid=c5.srvcid AND ;
> UBILLDIST=c5.UBILLDIST AND ;
> stdntid=c5.stdntid AND ;
> C1 = c5.C1 AND C4 = c5.C4
> UPDATE BL731 SET wrkNbrday2=c5.wrkNbrDate ;
> WHERE srvcid=c5.srvcid AND ;
> UBILLDIST=c5.UBILLDIST AND ;
> stdntid=c5.stdntid AND ;
> (C1 <> c5.C1 OR C4 <> c5.C4)
> UPDATE ctmpc1 SET wrkNbrday2=c5.wrkNbrDate ;
> WHERE srvcid=c5.srvcid AND ;
> UBILLDIST=c5.UBILLDIST AND ;
> C1 = c5.C1 AND C4 = c5.C4
>ENDSCAN
>USE IN c5
>
>
>Again, Thanks for the help.
>Beth
Hi Beth,
Quick answer, because I'm a bit tired. Create an index for matching fields only. Use the same approach Rich suggested but add a condition
FOR FOUND('mySecondCursor') AND myFieldThatShouldNotMatch <> mySecondCursor.MyFieldThatShouldNotMatch
If it's not broken, fix it until it is.
My Blog