Use Trigger To Avoid Duplicates?
Posted on 2004-03-22
I have encountered a situation that causes duplicate records - which, in turn, causes difficulties in billing. So I decided to alter/change the AccountData table with UNIQUE constraints to repel the duplicate records. That solution worked fine until the Error Log filled up.
So I got wind of an idea: someone mentioned using a TRIGGER (FOR INSERT, I beleive) to "flag those duplicate records as duplicates". But it turns out to be easier said than done.
Now I'm at an impasse: I have no idea how to get the trigger to check for duplicates, and flag the incoming record as duplicate when it turns out to BE a duplicate. I figure overloading a column will suffice (to detect the dupes at billing time), but avoiding self-reference has been a real BEAR.
Does anybody have any idea how I could tackle this beast?
Thank you (in advance),