Subject | Re: Triggers to automagically add/modify/delete data in another table ? |
---|---|
Author | Adam |
Post date | 2006-05-08T23:43:34Z |
--- In firebird-support@yahoogroups.com, Adriano <fadrianoc@...> wrote:
in TableA is enough to correctly populate TableB. Are you sure TableB
should not simply be a view?
Not knowing the precise nature of the problem, and assuming the view
suggested above is not a possibility, then you would define the unique
ID as a foreign key with cascading deletes. This would handle the
delete problem.
The insert and update problem are simple triggers.
unless you require some features only available in FB 2, I would stick
with FB 1.5 until FB 2 is actually released.
Adam
>It seems like a strange requirement, that information contained solely
> Hi,
> i've this elementary problem.
> I've two table (table A and table B).
>
> When add/modify/delete data in table A i need to add/modify/delete
> (some data of table A) also in table B.
>
> When use access database i put in table B a field in which i insert
> the Unique ID of table A so that:
> 1) new data in table A: after insert new data (row) i detect Unique ID
> and add also data and ID in table B
> 2) modify data in table A: i detect the unique ID, find it in table B
> and modify data also in table B
> 3) deleta data in table A: i detect the unique ID, find it in table B
> and delete data also in table B
>
> With firebirs which is the best way to do that ?
in TableA is enough to correctly populate TableB. Are you sure TableB
should not simply be a view?
Not knowing the precise nature of the problem, and assuming the view
suggested above is not a possibility, then you would define the unique
ID as a foreign key with cascading deletes. This would handle the
delete problem.
The insert and update problem are simple triggers.
> Using a trigger ?row of data ?
> How to retreive the Unique ID of table A after the insert of a new
>Given that you don't seem to be familiar with triggers in Firebird,
> Some example is avaible for that scenario ?
> I use FB 2.x but cannot find the employee example database.
unless you require some features only available in FB 2, I would stick
with FB 1.5 until FB 2 is actually released.
Adam