Subject Re: Help with Duplicate check algorithm
Author Alexander V.Nevsky
--- In firebird-support@yahoogroups.com, "Don Gollahon"
<gollahon@g...> wrote:

> Any ideas or comments on this would be appreciated.

Don, ideas of 2 kinds:

1. Personally I prefer removing the dup check from the import process
and making it a post processing method. But I would make it like

Select Col1, Col2, ... ColN, Count(*)
From Table
Where [conditions to filter newly inserted rows only]
Group By Col1, Col2, ... ColN
Having Count(*)>1

and then scan only this records by attributes to assign one of them
primary status and duplicate one to others.

2. If continue to catch duplicates on insert, move it to trigger as
Raymond suggested and check duplicates like

If (Exists (Select ID FROM Table Where [check conditions])) Then
...
ELSE
...

Best regards, Alexander.