rhythmscribe
September 17th, 2001, 05:46 PM
Hi,
I'm writing some code for work, the goal of which is to assign records from one table
(SOURCE) to the appropriate sales rep stored in another table (CSR). The association
occurs via postal code.
In the first iteration of the code, the CSR table contained postal code ranges (i.e.
Bob = 92XXX). However, the data that populates that table has changed, and now each
sales rep has a low and a high postal code as a range (i.e. Bob = 92000 (low) and 92999
(high)).
In the first instance, I was using the boolean Like function to determine if a record
from the SOURCE table should be associated to a particular sales rep (i.e. 92564 Like
92XXX). In the second instance, I employed comparison operators to do the same job
(i.e. 92564 >= 92000 AND 92564 <= 92999). What I have found is that using the comparison
operators causes the same code to take 3 times as long to run through the entire SOURCE
table. For example, if it took 20 seconds to run through 2000 rows in the first version,
it now takes 60 seconds to run through the same records.
Do the comparison operators just use up more memory than the Like function? Is there
anything I can do to reduce the time it takes to churn through the data?
Thanks,
-Mike
I'm writing some code for work, the goal of which is to assign records from one table
(SOURCE) to the appropriate sales rep stored in another table (CSR). The association
occurs via postal code.
In the first iteration of the code, the CSR table contained postal code ranges (i.e.
Bob = 92XXX). However, the data that populates that table has changed, and now each
sales rep has a low and a high postal code as a range (i.e. Bob = 92000 (low) and 92999
(high)).
In the first instance, I was using the boolean Like function to determine if a record
from the SOURCE table should be associated to a particular sales rep (i.e. 92564 Like
92XXX). In the second instance, I employed comparison operators to do the same job
(i.e. 92564 >= 92000 AND 92564 <= 92999). What I have found is that using the comparison
operators causes the same code to take 3 times as long to run through the entire SOURCE
table. For example, if it took 20 seconds to run through 2000 rows in the first version,
it now takes 60 seconds to run through the same records.
Do the comparison operators just use up more memory than the Like function? Is there
anything I can do to reduce the time it takes to churn through the data?
Thanks,
-Mike