record comparison 
Author Message
 record comparison

My application uses an Access database for data storage.
The table have many columns to classify the data set.
Before the new data set can be stored as an entry, the application has to
check the current table for any entry that is identical. Instead of
comparing field by field, I would like each record has its own unique value,
that is generated by, let say, binary arithmetic. That value is calculated
at the time the record is generated. My dataset is mainly character fields,
but I guess binary calculation is more suitable.
Do anyone knows this kind of algorithm? Do access database provide this
function?
Thanx


Mon, 28 Nov 2005 12:00:21 GMT  
 record comparison
The technique you want is called hashing, and there is built-in code in
Windows for doing it. But the hash result tends to be quite a long string.
Unless your text fields are very long, it would be easier simply to
concatenate the fields and use that as your unique value.

Easier still would be to add a unique index containing the fields that
matter. Then you don't need to do anything at all: simply try to add the new
record and allow the update to fail if the record exists already.


Quote:
> My application uses an Access database for data storage.
> The table have many columns to classify the data set.
> Before the new data set can be stored as an entry, the application has to
> check the current table for any entry that is identical. Instead of
> comparing field by field, I would like each record has its own unique
value,
> that is generated by, let say, binary arithmetic. That value is calculated
> at the time the record is generated. My dataset is mainly character
fields,
> but I guess binary calculation is more suitable.
> Do anyone knows this kind of algorithm? Do access database provide this
> function?
> Thanx



Mon, 28 Nov 2005 14:07:54 GMT  
 record comparison

Quote:
> My application uses an Access database for data storage.
> The table have many columns to classify the data set.
> Before the new data set can be stored as an entry, the application has to
> check the current table for any entry that is identical. Instead of
> comparing field by field, I would like each record has its own unique
value,
> that is generated by, let say, binary arithmetic. That value is calculated
> at the time the record is generated. My dataset is mainly character
fields,
> but I guess binary calculation is more suitable.
> Do anyone knows this kind of algorithm? Do access database provide this
> function?
> Thanx

Interesting idea, but I'm not sure if it's implementable in the way you'd
like.
You could do all sorts of things with the fields and contents thereof and
come up with
some kind of number, but I think you'd have a very hard time ensuring that
number
would be unique for all possible combinations of the fields.
    MS Access does provide a sort of solution for this; a unique index
containing all significant fields.
If you try to add a record with identical index values it'll throw an error
(or may just not add the
record without throwing an error, test to be sure). However an index that
contains a lot of fields
will slow down additions to the table, possibly significantly.
    I think you'd be better off grunting out the code to compare all
significant values rather
than spending time looking for an elegant solution.

Dave G



Mon, 28 Nov 2005 14:23:12 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. String comparison does not work

2. Null comparison with string

3. Text comparison

4. Comparison Operator - Erratic Behaviour

5. Table comparison

6. Visual Foxpro vs Jet 3.5 -- Comparison (Help!)

7. VFP vs Jet 3.5 Comparison (Help!)

8. Case-Sensitive Comparisons

9. address comparison

10. Speed of SQL Comparisons

11. Comparisons using code

12. AND Bitwise Comparison

 

 
Powered by phpBB® Forum Software