Re: How to check for duplicates?
From: Ignacio Vazquez (ivazquezATorioncommunications.com)
Date: 11/14/03
- Next message: Brian Evans: "Re: IO is being open sourced"
- Previous message: Jon E. Scott: "Re: How to check for duplicates?"
- In reply to: Zoran: "How to check for duplicates?"
- Next in thread: Zoran: "Re: How to check for duplicates?"
- Reply: Zoran: "Re: How to check for duplicates?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 14 Nov 2003 14:54:56 -0500
<Zoran> wrote in message 3fb5322e$1@newsgroups.borland.com...
> Before inserting a new record into the table I need to check for
> duplicates. Duplicate is if FirstName, LastName, Street, City, State, and
> ZIP are equal. I don't want to have combination of all these fields as an
> index.
>
> What would be the most elegant and fastest way to check this?
The most elegant and fastest way would be to create a unique index based on
those fields and catch the exception upon insertion. Since you don't want to
do that, the next way would be to do a SELECT COUNT(*) with those fields in
the WHERE clause. Doing a checksum for those fields 1) depends on what
database you're using, and 2) isn't necessarily faster than doing a
preliminary SELECT.
Cheers,
Ignacio
- Next message: Brian Evans: "Re: IO is being open sourced"
- Previous message: Jon E. Scott: "Re: How to check for duplicates?"
- In reply to: Zoran: "How to check for duplicates?"
- Next in thread: Zoran: "Re: How to check for duplicates?"
- Reply: Zoran: "Re: How to check for duplicates?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|