>Because of the WHILE.
>
>Is this your way of saying that you really didn't have the SEEK in your original test?
No, this is what I'm saying precisely:
seek and then sum while myCond should return exactly the same result as select where myCond, but they do not do this. If I do seek and then select sum vs. SUM they match. I should not do SEEK before SELECT SUM. Thus I conclude that my indexes are corrupted. In two mismatch cases I found by these tests first time the invoice was for different salesman and the second case it was not in the table at all. I tried to SEEK invoice using SET EXACT OFF, SET ANSI OFF, SET DELETED OFF. Paradoxycally, SELECT * from table where inv = my Bad Invoice also returned 0 records. So, why do I have these weird results running code is still a mystery.
I just re-indexes the table on Com_Inv (Inv_No + salesman) and I got the bad results again
Found a mismatch on I801972COL cRate = 0 laArr[1]= 0.100000000
Found a mismatch on I518767COL cRate = 0 laArr[1]= 0.100000000
If it's not broken, fix it until it is.
My Blog