|
Posted by Jason Lepack on 06/11/07 18:39
I could be wrong but is your problem based on the fact that you want
to select all items from Table A and any matching records from Table
B?
If so then ignore the use of the trigger and then use this query:
SELECT
pk_A,
pk_B
FROM
A
LEFT JOIN B
ON A.pk_A = B.fk_B_A
On Jun 11, 2:32 pm, Wojto <jestem.woj...@interia.pl> wrote:
> Well.. This tables are only an example... They are much more complex in
> fact, so I can't simply put data in the B table. I need to do it in
> "normal" way. But after puting something into table A the trigger fires
> and removes the invalid record (rollback), so I can't put anything into
> the tables. So if the trigger is correct how can I put something into
> both tables without doing it in the body of the trigger.
> :-)
> Thanx for help
>
>
>
> > So let's get this straight.
>
> > The constraint on fk_B_A will not let you enter data into that field
> > unless it already exists in pk_A in A.
>
> > Your trigger that you have created will ensure that no data will get
> > into pk_a that does not already exist in fk_B_A, so it seems to be
> > working fine.
>
> > What exactly do you want to do? Do you want to ensure that after you
> > insert a record into A, a matching record gets inserted into B?
>
> > If so then your trigger should insert a record if one didn't exist.- Hide quoted text -
>
> - Show quoted text -
[Back to original message]
|