Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / FoxPro / General FoxPro Topics / July 2008

Tip: Looking for answers? Try searching our database.

Trigger problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
W.Davis - 20 Jul 2008 21:08 GMT
Group,
Is there any way to get around a trigger when trying to remove a duplicate
record? I get 'trigger failed' , of course. Would I have to delete the
procedures (i.e modify procedures) and redo them after the delete?
Wade
Christof Wollenhaupt - 21 Jul 2008 10:00 GMT
Hi Wade,

If you have two records that are now invalid and will fire the delete
trigger, you could first change one of them, for example, replace the
primary key.

If the question is how you can re-use a key once you deleted a record with
the same key, then the answer would be to use an index with a FOR NOT
DELETED() clause as the primary key. Of course, the question would be, why
you have repeating primary keys, at all.

Signature

Christof

W.Davis - 21 Jul 2008 12:15 GMT
Thanks Christof,
What I do now is create a cursor with the duplicates, index on it unique,
index on the table unique, set relation from the cursor to the table, and
scan the cursor, deleting dups from the table. It seems to work o.k., but
seems to be a kludge.
Wade

> Hi Wade,
>
[quoted text clipped - 6 lines]
> DELETED() clause as the primary key. Of course, the question would be, why
> you have repeating primary keys, at all.
ED - 30 Jul 2008 09:02 GMT
My 2c,

Quicker way would be to:
no index set
delete all
set index to unique tag
set deleted  off
recall all
pack if necessary

No need to scan and compare.

ED

Thanks Christof,
What I do now is create a cursor with the duplicates, index on it unique,
index on the table unique, set relation from the cursor to the table, and
scan the cursor, deleting dups from the table. It seems to work o.k., but
seems to be a kludge.
Wade

"Christof Wollenhaupt" <msnews.microsoft.com.20050422@prolib.de> wrote in
message news:u3yfvAx6IHA.5012@TK2MSFTNGP02.phx.gbl...
> Hi Wade,
>
[quoted text clipped - 6 lines]
> DELETED() clause as the primary key. Of course, the question would be, why
> you have repeating primary keys, at all.
W. Davis - 30 Jul 2008 14:40 GMT
Thanks ED,
I knew the way I did it was a 'kludge'. I like the simplicity of your
suggestion.
Wade

> My 2c,
>
[quoted text clipped - 32 lines]
> > --
> > Christof
ED - 31 Jul 2008 07:40 GMT
You're welcome. Glad you checked back on the thread...
ED

Thanks ED,
I knew the way I did it was a 'kludge'. I like the simplicity of your
suggestion.
Wade

> My 2c,
>
[quoted text clipped - 26 lines]
> >
> > If the question is how you can re-use a key once you deleted a record
with
> > the same key, then the answer would be to use an index with a FOR NOT
> > DELETED() clause as the primary key. Of course, the question would be,
why
> > you have repeating primary keys, at all.
> >
> > --
> > Christof
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.